clang 15.0.7
Sema.h
Go to the documentation of this file.
1//===--- Sema.h - Semantic Analysis & AST Building --------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file defines the Sema class, which performs semantic analysis and
10// builds ASTs.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_SEMA_SEMA_H
15#define LLVM_CLANG_SEMA_SEMA_H
16
18#include "clang/AST/ASTFwd.h"
19#include "clang/AST/Attr.h"
24#include "clang/AST/Expr.h"
25#include "clang/AST/ExprCXX.h"
27#include "clang/AST/ExprObjC.h"
32#include "clang/AST/NSAPI.h"
34#include "clang/AST/StmtCXX.h"
36#include "clang/AST/TypeLoc.h"
42#include "clang/Basic/Module.h"
51#include "clang/Sema/DeclSpec.h"
56#include "clang/Sema/Scope.h"
59#include "clang/Sema/Weak.h"
60#include "llvm/ADT/ArrayRef.h"
61#include "llvm/ADT/Optional.h"
62#include "llvm/ADT/SetVector.h"
63#include "llvm/ADT/SmallBitVector.h"
64#include "llvm/ADT/SmallPtrSet.h"
65#include "llvm/ADT/SmallSet.h"
66#include "llvm/ADT/SmallVector.h"
67#include "llvm/ADT/TinyPtrVector.h"
68#include "llvm/Frontend/OpenMP/OMPConstants.h"
69#include <deque>
70#include <memory>
71#include <string>
72#include <tuple>
73#include <vector>
74
75namespace llvm {
76 class APSInt;
77 template <typename ValueT, typename ValueInfoT> class DenseSet;
78 class SmallBitVector;
79 struct InlineAsmIdentifierInfo;
80}
81
82namespace clang {
83 class ADLResult;
84 class ASTConsumer;
85 class ASTContext;
86 class ASTMutationListener;
87 class ASTReader;
88 class ASTWriter;
89 class ArrayType;
90 class ParsedAttr;
91 class BindingDecl;
92 class BlockDecl;
93 class CapturedDecl;
94 class CXXBasePath;
95 class CXXBasePaths;
96 class CXXBindTemporaryExpr;
98 class CXXConstructorDecl;
99 class CXXConversionDecl;
100 class CXXDeleteExpr;
101 class CXXDestructorDecl;
102 class CXXFieldCollector;
103 class CXXMemberCallExpr;
104 class CXXMethodDecl;
105 class CXXScopeSpec;
106 class CXXTemporary;
107 class CXXTryStmt;
108 class CallExpr;
109 class ClassTemplateDecl;
110 class ClassTemplatePartialSpecializationDecl;
111 class ClassTemplateSpecializationDecl;
112 class VarTemplatePartialSpecializationDecl;
113 class CodeCompleteConsumer;
114 class CodeCompletionAllocator;
115 class CodeCompletionTUInfo;
116 class CodeCompletionResult;
117 class CoroutineBodyStmt;
118 class Decl;
119 class DeclAccessPair;
120 class DeclContext;
121 class DeclRefExpr;
122 class DeclaratorDecl;
123 class DeducedTemplateArgument;
124 class DependentDiagnostic;
125 class DesignatedInitExpr;
126 class Designation;
127 class EnableIfAttr;
128 class EnumConstantDecl;
129 class Expr;
130 class ExtVectorType;
131 class FormatAttr;
132 class FriendDecl;
133 class FunctionDecl;
134 class FunctionProtoType;
135 class FunctionTemplateDecl;
136 class ImplicitConversionSequence;
138 class InitListExpr;
139 class InitializationKind;
140 class InitializationSequence;
141 class InitializedEntity;
142 class IntegerLiteral;
143 class LabelStmt;
144 class LambdaExpr;
145 class LangOptions;
146 class LocalInstantiationScope;
147 class LookupResult;
148 class MacroInfo;
150 class ModuleLoader;
151 class MultiLevelTemplateArgumentList;
152 class NamedDecl;
153 class ObjCCategoryDecl;
154 class ObjCCategoryImplDecl;
155 class ObjCCompatibleAliasDecl;
156 class ObjCContainerDecl;
157 class ObjCImplDecl;
158 class ObjCImplementationDecl;
159 class ObjCInterfaceDecl;
160 class ObjCIvarDecl;
161 template <class T> class ObjCList;
162 class ObjCMessageExpr;
163 class ObjCMethodDecl;
164 class ObjCPropertyDecl;
165 class ObjCProtocolDecl;
167 class OMPRequiresDecl;
169 class OMPDeclareSimdDecl;
170 class OMPClause;
171 struct OMPVarListLocTy;
172 struct OverloadCandidate;
173 enum class OverloadCandidateParamOrder : char;
176 class OverloadExpr;
177 class ParenListExpr;
178 class ParmVarDecl;
179 class Preprocessor;
181 class PseudoObjectExpr;
182 class QualType;
184 class Stmt;
185 class StringLiteral;
186 class SwitchStmt;
187 class TemplateArgument;
190 class TemplateDecl;
195 class Token;
196 class TypeAliasDecl;
197 class TypedefDecl;
198 class TypedefNameDecl;
199 class TypeLoc;
201 class UnqualifiedId;
204 class UnresolvedSetImpl;
206 class UsingDecl;
207 class UsingShadowDecl;
208 class ValueDecl;
209 class VarDecl;
211 class VisibilityAttr;
213 class IndirectFieldDecl;
216
217namespace sema {
218 class AccessedEntity;
219 class BlockScopeInfo;
220 class Capture;
222 class CapturingScopeInfo;
223 class CompoundScopeInfo;
224 class DelayedDiagnostic;
226 class FunctionScopeInfo;
227 class LambdaScopeInfo;
230 class SemaPPCallbacks;
232}
233
234namespace threadSafety {
235 class BeforeSet;
236 void threadSafetyCleanup(BeforeSet* Cache);
237}
238
239// FIXME: No way to easily map from TemplateTypeParmTypes to
240// TemplateTypeParmDecls, so we have this horrible PointerUnion.
241typedef std::pair<llvm::PointerUnion<const TemplateTypeParmType*, NamedDecl*>,
243
244/// Describes whether we've seen any nullability information for the given
245/// file.
247 /// The first pointer declarator (of any pointer kind) in the file that does
248 /// not have a corresponding nullability annotation.
250
251 /// The end location for the first pointer declarator in the file. Used for
252 /// placing fix-its.
254
255 /// Which kind of pointer declarator we saw.
256 uint8_t PointerKind;
257
258 /// Whether we saw any type nullability annotations in the given file.
259 bool SawTypeNullability = false;
260};
261
262/// A mapping from file IDs to a record of whether we've seen nullability
263/// information in that file.
265 /// A mapping from file IDs to the nullability information for each file ID.
266 llvm::DenseMap<FileID, FileNullability> Map;
267
268 /// A single-element cache based on the file ID.
269 struct {
272 } Cache;
273
274public:
276 // Check the single-element cache.
277 if (file == Cache.File)
278 return Cache.Nullability;
279
280 // It's not in the single-element cache; flush the cache if we have one.
281 if (!Cache.File.isInvalid()) {
282 Map[Cache.File] = Cache.Nullability;
283 }
284
285 // Pull this entry into the cache.
286 Cache.File = file;
287 Cache.Nullability = Map[file];
288 return Cache.Nullability;
289 }
290};
291
292/// Tracks expected type during expression parsing, for use in code completion.
293/// The type is tied to a particular token, all functions that update or consume
294/// the type take a start location of the token they are looking at as a
295/// parameter. This avoids updating the type on hot paths in the parser.
297public:
298 PreferredTypeBuilder(bool Enabled) : Enabled(Enabled) {}
299
303 /// Handles e.g. BaseType{ .D = Tok...
305 const Designation &D);
306 /// Computing a type for the function argument may require running
307 /// overloading, so we postpone its computation until it is actually needed.
308 ///
309 /// Clients should be very careful when using this funciton, as it stores a
310 /// function_ref, clients should make sure all calls to get() with the same
311 /// location happen while function_ref is alive.
312 ///
313 /// The callback should also emit signature help as a side-effect, but only
314 /// if the completion point has been reached.
316 llvm::function_ref<QualType()> ComputeType);
317
320 SourceLocation OpLoc);
323 void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS);
324 /// Handles all type casts, including C-style cast, C++ casts, etc.
326
327 /// Get the expected type associated with this location, if any.
328 ///
329 /// If the location is a function argument, determining the expected type
330 /// involves considering all function overloads and the arguments so far.
331 /// In this case, signature help for these function overloads will be reported
332 /// as a side-effect (only if the completion point has been reached).
334 if (!Enabled || Tok != ExpectedLoc)
335 return QualType();
336 if (!Type.isNull())
337 return Type;
338 if (ComputeType)
339 return ComputeType();
340 return QualType();
341 }
342
343private:
344 bool Enabled;
345 /// Start position of a token for which we store expected type.
346 SourceLocation ExpectedLoc;
347 /// Expected type for a token starting at ExpectedLoc.
349 /// A function to compute expected type at ExpectedLoc. It is only considered
350 /// if Type is null.
351 llvm::function_ref<QualType()> ComputeType;
352};
353
354/// Sema - This implements semantic analysis and AST building for C.
355class Sema final {
356 Sema(const Sema &) = delete;
357 void operator=(const Sema &) = delete;
358
359 ///Source of additional semantic information.
360 ExternalSemaSource *ExternalSource;
361
362 ///Whether Sema has generated a multiplexer and has to delete it.
363 bool isMultiplexExternalSource;
364
365 static bool mightHaveNonExternalLinkage(const DeclaratorDecl *FD);
366
367 /// Determine whether two declarations should be linked together, given that
368 /// the old declaration might not be visible and the new declaration might
369 /// not have external linkage.
370 bool shouldLinkPossiblyHiddenDecl(const NamedDecl *Old,
371 const NamedDecl *New) {
372 if (isVisible(Old))
373 return true;
374 // See comment in below overload for why it's safe to compute the linkage
375 // of the new declaration here.
376 if (New->isExternallyDeclarable()) {
377 assert(Old->isExternallyDeclarable() &&
378 "should not have found a non-externally-declarable previous decl");
379 return true;
380 }
381 return false;
382 }
383 bool shouldLinkPossiblyHiddenDecl(LookupResult &Old, const NamedDecl *New);
384
385 void setupImplicitSpecialMemberType(CXXMethodDecl *SpecialMem,
386 QualType ResultTy,
387 ArrayRef<QualType> Args);
388
389public:
390 /// The maximum alignment, same as in llvm::Value. We duplicate them here
391 /// because that allows us not to duplicate the constants in clang code,
392 /// which we must to since we can't directly use the llvm constants.
393 /// The value is verified against llvm here: lib/CodeGen/CGDecl.cpp
394 ///
395 /// This is the greatest alignment value supported by load, store, and alloca
396 /// instructions, and global values.
397 static const unsigned MaxAlignmentExponent = 32;
399
403
406
413
414 /// Flag indicating whether or not to collect detailed statistics.
416
417 /// Code-completion consumer.
419
420 /// CurContext - This is the current declaration context of parsing.
422
423 /// Generally null except when we temporarily switch decl contexts,
424 /// like in \see ActOnObjCTemporaryExitContainerContext.
426
427 /// VAListTagName - The declaration name corresponding to __va_list_tag.
428 /// This is used as part of a hack to omit that class from ADL results.
430
431 bool MSStructPragmaOn; // True when \#pragma ms_struct on
432
433 /// Controls member pointer representation format under the MS ABI.
436
437 /// Stack of active SEH __finally scopes. Can be empty.
439
440 /// Source location for newly created implicit MSInheritanceAttrs
442
443 /// Holds TypoExprs that are created from `createDelayedTypo`. This is used by
444 /// `TransformTypos` in order to keep track of any TypoExprs that are created
445 /// recursively during typo correction and wipe them away if the correction
446 /// fails.
448
449 /// pragma clang section kind
458
463
469
475
477 PSK_Reset = 0x0, // #pragma ()
478 PSK_Set = 0x1, // #pragma (value)
479 PSK_Push = 0x2, // #pragma (push[, id])
480 PSK_Pop = 0x4, // #pragma (pop[, id])
481 PSK_Show = 0x8, // #pragma (show) -- only for "pack"!
482 PSK_Push_Set = PSK_Push | PSK_Set, // #pragma (push[, id], value)
483 PSK_Pop_Set = PSK_Pop | PSK_Set, // #pragma (pop[, id], value)
484 };
485
486 // #pragma pack and align.
488 public:
489 // `Native` represents default align mode, which may vary based on the
490 // platform.
491 enum Mode : unsigned char { Native, Natural, Packed, Mac68k };
492
493 // #pragma pack info constructor
494 AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
495 : PackAttr(true), AlignMode(M), PackNumber(Num), XLStack(IsXL) {
496 assert(Num == PackNumber && "The pack number has been truncated.");
497 }
498
499 // #pragma align info constructor
501 : PackAttr(false), AlignMode(M),
502 PackNumber(M == Packed ? 1 : UninitPackVal), XLStack(IsXL) {}
503
504 explicit AlignPackInfo(bool IsXL) : AlignPackInfo(Native, IsXL) {}
505
507
508 // When a AlignPackInfo itself cannot be used, this returns an 32-bit
509 // integer encoding for it. This should only be passed to
510 // AlignPackInfo::getFromRawEncoding, it should not be inspected directly.
511 static uint32_t getRawEncoding(const AlignPackInfo &Info) {
512 std::uint32_t Encoding{};
513 if (Info.IsXLStack())
514 Encoding |= IsXLMask;
515
516 Encoding |= static_cast<uint32_t>(Info.getAlignMode()) << 1;
517
518 if (Info.IsPackAttr())
519 Encoding |= PackAttrMask;
520
521 Encoding |= static_cast<uint32_t>(Info.getPackNumber()) << 4;
522
523 return Encoding;
524 }
525
526 static AlignPackInfo getFromRawEncoding(unsigned Encoding) {
527 bool IsXL = static_cast<bool>(Encoding & IsXLMask);
529 static_cast<AlignPackInfo::Mode>((Encoding & AlignModeMask) >> 1);
530 int PackNumber = (Encoding & PackNumMask) >> 4;
531
532 if (Encoding & PackAttrMask)
533 return AlignPackInfo(M, PackNumber, IsXL);
534
535 return AlignPackInfo(M, IsXL);
536 }
537
538 bool IsPackAttr() const { return PackAttr; }
539
540 bool IsAlignAttr() const { return !PackAttr; }
541
542 Mode getAlignMode() const { return AlignMode; }
543
544 unsigned getPackNumber() const { return PackNumber; }
545
546 bool IsPackSet() const {
547 // #pragma align, #pragma pack(), and #pragma pack(0) do not set the pack
548 // attriute on a decl.
549 return PackNumber != UninitPackVal && PackNumber != 0;
550 }
551
552 bool IsXLStack() const { return XLStack; }
553
554 bool operator==(const AlignPackInfo &Info) const {
555 return std::tie(AlignMode, PackNumber, PackAttr, XLStack) ==
556 std::tie(Info.AlignMode, Info.PackNumber, Info.PackAttr,
557 Info.XLStack);
558 }
559
560 bool operator!=(const AlignPackInfo &Info) const {
561 return !(*this == Info);
562 }
563
564 private:
565 /// \brief True if this is a pragma pack attribute,
566 /// not a pragma align attribute.
567 bool PackAttr;
568
569 /// \brief The alignment mode that is in effect.
570 Mode AlignMode;
571
572 /// \brief The pack number of the stack.
573 unsigned char PackNumber;
574
575 /// \brief True if it is a XL #pragma align/pack stack.
576 bool XLStack;
577
578 /// \brief Uninitialized pack value.
579 static constexpr unsigned char UninitPackVal = -1;
580
581 // Masks to encode and decode an AlignPackInfo.
582 static constexpr uint32_t IsXLMask{0x0000'0001};
583 static constexpr uint32_t AlignModeMask{0x0000'0006};
584 static constexpr uint32_t PackAttrMask{0x00000'0008};
585 static constexpr uint32_t PackNumMask{0x0000'01F0};
586 };
587
588 template<typename ValueType>
589 struct PragmaStack {
601
602 void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action,
603 llvm::StringRef StackSlotLabel, ValueType Value) {
604 if (Action == PSK_Reset) {
606 CurrentPragmaLocation = PragmaLocation;
607 return;
608 }
609 if (Action & PSK_Push)
610 Stack.emplace_back(StackSlotLabel, CurrentValue, CurrentPragmaLocation,
611 PragmaLocation);
612 else if (Action & PSK_Pop) {
613 if (!StackSlotLabel.empty()) {
614 // If we've got a label, try to find it and jump there.
615 auto I = llvm::find_if(llvm::reverse(Stack), [&](const Slot &x) {
616 return x.StackSlotLabel == StackSlotLabel;
617 });
618 // If we found the label so pop from there.
619 if (I != Stack.rend()) {
620 CurrentValue = I->Value;
621 CurrentPragmaLocation = I->PragmaLocation;
622 Stack.erase(std::prev(I.base()), Stack.end());
623 }
624 } else if (!Stack.empty()) {
625 // We do not have a label, just pop the last entry.
626 CurrentValue = Stack.back().Value;
627 CurrentPragmaLocation = Stack.back().PragmaLocation;
628 Stack.pop_back();
629 }
630 }
631 if (Action & PSK_Set) {
633 CurrentPragmaLocation = PragmaLocation;
634 }
635 }
636
637 // MSVC seems to add artificial slots to #pragma stacks on entering a C++
638 // method body to restore the stacks on exit, so it works like this:
639 //
640 // struct S {
641 // #pragma <name>(push, InternalPragmaSlot, <current_pragma_value>)
642 // void Method {}
643 // #pragma <name>(pop, InternalPragmaSlot)
644 // };
645 //
646 // It works even with #pragma vtordisp, although MSVC doesn't support
647 // #pragma vtordisp(push [, id], n)
648 // syntax.
649 //
650 // Push / pop a named sentinel slot.
651 void SentinelAction(PragmaMsStackAction Action, StringRef Label) {
652 assert((Action == PSK_Push || Action == PSK_Pop) &&
653 "Can only push / pop #pragma stack sentinels!");
655 }
656
657 // Constructors.
658 explicit PragmaStack(const ValueType &Default)
660
661 bool hasValue() const { return CurrentValue != DefaultValue; }
662
664 ValueType DefaultValue; // Value used for PSK_Reset action.
665 ValueType CurrentValue;
667 };
668 // FIXME: We should serialize / deserialize these if they occur in a PCH (but
669 // we shouldn't do so if they're in a module).
670
671 /// Whether to insert vtordisps prior to virtual bases in the Microsoft
672 /// C++ ABI. Possible values are 0, 1, and 2, which mean:
673 ///
674 /// 0: Suppress all vtordisps
675 /// 1: Insert vtordisps in the presence of vbase overrides and non-trivial
676 /// structors
677 /// 2: Always insert vtordisps to support RTTI on partially constructed
678 /// objects
681 // The current #pragma align/pack values and locations at each #include.
688 // Segment #pragmas.
693
694 // This stack tracks the current state of Sema.CurFPFeatures.
697 FPOptionsOverride result;
698 if (!FpPragmaStack.hasValue()) {
699 result = FPOptionsOverride();
700 } else {
701 result = FpPragmaStack.CurrentValue;
702 }
703 return result;
704 }
705
706 // RAII object to push / pop sentinel slots for all MS #pragma stacks.
707 // Actions should be performed only if we enter / exit a C++ method body.
709 public:
710 PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct);
712
713 private:
714 Sema &S;
715 StringRef SlotLabel;
716 bool ShouldAct;
717 };
718
719 /// A mapping that describes the nullability we've seen in each header file.
721
722 /// Last section used with #pragma init_seg.
725
726 /// Sections used with #pragma alloc_text.
727 llvm::StringMap<std::tuple<StringRef, SourceLocation>> FunctionToSectionMap;
728
729 /// VisContext - Manages the stack for \#pragma GCC visibility.
730 void *VisContext; // Really a "PragmaVisStack*"
731
732 /// This an attribute introduced by \#pragma clang attribute.
739
740 /// A push'd group of PragmaAttributeEntries.
742 /// The location of the push attribute.
744 /// The namespace of this push group.
747 };
748
750
751 /// The declaration that is currently receiving an attribute from the
752 /// #pragma attribute stack.
754
755 /// This represents the last location of a "#pragma clang optimize off"
756 /// directive if such a directive has not been closed by an "on" yet. If
757 /// optimizations are currently "on", this is set to an invalid location.
759
760 /// The "on" or "off" argument passed by \#pragma optimize, that denotes
761 /// whether the optimizations in the list passed to the pragma should be
762 /// turned off or on. This boolean is true by default because command line
763 /// options are honored when `#pragma optimize("", on)`.
764 /// (i.e. `ModifyFnAttributeMSPragmaOptimze()` does nothing)
766
767 /// Set of no-builtin functions listed by \#pragma function.
769
770 /// Flag indicating if Sema is building a recovery call expression.
771 ///
772 /// This flag is used to avoid building recovery call expressions
773 /// if Sema is already doing so, which would cause infinite recursions.
775
776 /// Used to control the generation of ExprWithCleanups.
778
779 /// ExprCleanupObjects - This is the stack of objects requiring
780 /// cleanup that are created by the current full expression.
782
783 /// Store a set of either DeclRefExprs or MemberExprs that contain a reference
784 /// to a variable (constant) that may or may not be odr-used in this Expr, and
785 /// we won't know until all lvalue-to-rvalue and discarded value conversions
786 /// have been applied to all subexpressions of the enclosing full expression.
787 /// This is cleared at the end of each full expression.
788 using MaybeODRUseExprSet = llvm::SetVector<Expr *, SmallVector<Expr *, 4>,
791
792 std::unique_ptr<sema::FunctionScopeInfo> CachedFunctionScope;
793
794 /// Stack containing information about each of the nested
795 /// function, block, and method scopes that are currently active.
797
798 /// The index of the first FunctionScope that corresponds to the current
799 /// context.
801
803 return llvm::makeArrayRef(FunctionScopes.begin() + FunctionScopesStart,
804 FunctionScopes.end());
805 }
806
807 /// Stack containing information needed when in C++2a an 'auto' is encountered
808 /// in a function declaration parameter type specifier in order to invent a
809 /// corresponding template parameter in the enclosing abbreviated function
810 /// template. This information is also present in LambdaScopeInfo, stored in
811 /// the FunctionScopes stack.
813
814 /// The index of the first InventedParameterInfo that refers to the current
815 /// context.
817
823
827
828 /// ExtVectorDecls - This is a list all the extended vector types. This allows
829 /// us to associate a raw vector type with one of the ext_vector type names.
830 /// This is only necessary for issuing pretty diagnostics.
832
833 /// FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
834 std::unique_ptr<CXXFieldCollector> FieldCollector;
835
837
838 /// Set containing all declared private fields that are not used.
840
841 /// Set containing all typedefs that are likely unused.
844
845 /// Delete-expressions to be analyzed at the end of translation unit
846 ///
847 /// This list contains class members, and locations of delete-expressions
848 /// that could not be proven as to whether they mismatch with new-expression
849 /// used in initializer of the field.
850 typedef std::pair<SourceLocation, bool> DeleteExprLoc;
852 llvm::MapVector<FieldDecl *, DeleteLocs> DeleteExprs;
853
855
856 /// PureVirtualClassDiagSet - a set of class declarations which we have
857 /// emitted a list of pure virtual functions. Used to prevent emitting the
858 /// same list more than once.
859 std::unique_ptr<RecordDeclSetTy> PureVirtualClassDiagSet;
860
861 /// ParsingInitForAutoVars - a set of declarations with auto types for which
862 /// we are currently parsing the initializer.
864
865 /// Look for a locally scoped extern "C" declaration by the given name.
867
871
872 /// All the tentative definitions encountered in the TU.
874
875 /// All the external declarations encoutered and used in the TU.
877
881
882 /// The set of file scoped decls seen so far that have not been used
883 /// and must warn if not used. Only contains the first declaration.
885
889
890 /// All the delegating constructors seen so far in the file, used for
891 /// cycle detection at the end of the TU.
893
894 /// All the overriding functions seen during a class definition
895 /// that had their exception spec checks delayed, plus the overridden
896 /// function.
899
900 /// All the function redeclarations seen during a class definition that had
901 /// their exception spec checks delayed, plus the prior declaration they
902 /// should be checked against. Except during error recovery, the new decl
903 /// should always be a friend declaration, as that's the only valid way to
904 /// redeclare a special member before its class is complete.
907
908 typedef llvm::MapVector<const FunctionDecl *,
909 std::unique_ptr<LateParsedTemplate>>
912
913 /// Callback to the parser to parse templated functions when needed.
914 typedef void LateTemplateParserCB(void *P, LateParsedTemplate &LPT);
915 typedef void LateTemplateParserCleanupCB(void *P);
919
921 LateTemplateParserCleanupCB *LTPCleanup,
922 void *P) {
923 LateTemplateParser = LTP;
924 LateTemplateParserCleanup = LTPCleanup;
925 OpaqueParser = P;
926 }
927
928 class DelayedDiagnostics;
929
936
937 /// A class which encapsulates the logic for delaying diagnostics
938 /// during parsing and other processing.
940 /// The current pool of diagnostics into which delayed
941 /// diagnostics should go.
943
944 public:
945 DelayedDiagnostics() : CurPool(nullptr) {}
946
947 /// Adds a delayed diagnostic.
948 void add(const sema::DelayedDiagnostic &diag); // in DelayedDiagnostic.h
949
950 /// Determines whether diagnostics should be delayed.
951 bool shouldDelayDiagnostics() { return CurPool != nullptr; }
952
953 /// Returns the current delayed-diagnostics pool.
955 return CurPool;
956 }
957
958 /// Enter a new scope. Access and deprecation diagnostics will be
959 /// collected in this pool.
962 state.SavedPool = CurPool;
963 CurPool = &pool;
964 return state;
965 }
966
967 /// Leave a delayed-diagnostic state that was previously pushed.
968 /// Do not emit any of the diagnostics. This is performed as part
969 /// of the bookkeeping of popping a pool "properly".
971 CurPool = state.SavedPool;
972 }
973
974 /// Enter a new scope where access and deprecation diagnostics are
975 /// not delayed.
978 state.SavedPool = CurPool;
979 CurPool = nullptr;
980 return state;
981 }
982
983 /// Undo a previous pushUndelayed().
985 assert(CurPool == nullptr);
986 CurPool = state.SavedPool;
987 }
989
990 /// A RAII object to temporarily push a declaration context.
992 private:
993 Sema &S;
994 DeclContext *SavedContext;
995 ProcessingContextState SavedContextState;
996 QualType SavedCXXThisTypeOverride;
997 unsigned SavedFunctionScopesStart;
998 unsigned SavedInventedParameterInfosStart;
999
1000 public:
1001 ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext = true)
1002 : S(S), SavedContext(S.CurContext),
1003 SavedContextState(S.DelayedDiagnostics.pushUndelayed()),
1004 SavedCXXThisTypeOverride(S.CXXThisTypeOverride),
1005 SavedFunctionScopesStart(S.FunctionScopesStart),
1006 SavedInventedParameterInfosStart(S.InventedParameterInfosStart)
1007 {
1008 assert(ContextToPush && "pushing null context");
1009 S.CurContext = ContextToPush;
1010 if (NewThisContext)
1011 S.CXXThisTypeOverride = QualType();
1012 // Any saved FunctionScopes do not refer to this context.
1013 S.FunctionScopesStart = S.FunctionScopes.size();
1014 S.InventedParameterInfosStart = S.InventedParameterInfos.size();
1015 }
1016
1017 void pop() {
1018 if (!SavedContext) return;
1019 S.CurContext = SavedContext;
1020 S.DelayedDiagnostics.popUndelayed(SavedContextState);
1021 S.CXXThisTypeOverride = SavedCXXThisTypeOverride;
1022 S.FunctionScopesStart = SavedFunctionScopesStart;
1023 S.InventedParameterInfosStart = SavedInventedParameterInfosStart;
1024 SavedContext = nullptr;
1025 }
1026
1028 pop();
1029 }
1030 };
1031
1032 /// Whether the AST is currently being rebuilt to correct immediate
1033 /// invocations. Immediate invocation candidates and references to consteval
1034 /// functions aren't tracked when this is set.
1036
1037 /// Used to change context to isConstantEvaluated without pushing a heavy
1038 /// ExpressionEvaluationContextRecord object.
1040
1042 return ExprEvalContexts.back().isConstantEvaluated() ||
1044 }
1045
1046 /// RAII object to handle the state changes required to synthesize
1047 /// a function body.
1049 Sema &S;
1050 Sema::ContextRAII SavedContext;
1051 bool PushedCodeSynthesisContext = false;
1052
1053 public:
1055 : S(S), SavedContext(S, DC) {
1056 S.PushFunctionScope();
1057 S.PushExpressionEvaluationContext(
1059 if (auto *FD = dyn_cast<FunctionDecl>(DC))
1060 FD->setWillHaveBody(true);
1061 else
1062 assert(isa<ObjCMethodDecl>(DC));
1063 }
1064
1066 assert(!PushedCodeSynthesisContext);
1067
1070 Ctx.PointOfInstantiation = UseLoc;
1071 Ctx.Entity = cast<Decl>(S.CurContext);
1072 S.pushCodeSynthesisContext(Ctx);
1073
1074 PushedCodeSynthesisContext = true;
1075 }
1076
1078 if (PushedCodeSynthesisContext)
1079 S.popCodeSynthesisContext();
1080 if (auto *FD = dyn_cast<FunctionDecl>(S.CurContext))
1081 FD->setWillHaveBody(false);
1082 S.PopExpressionEvaluationContext();
1083 S.PopFunctionScopeInfo();
1084 }
1085 };
1086
1087 /// WeakUndeclaredIdentifiers - Identifiers contained in \#pragma weak before
1088 /// declared. Rare. May alias another identifier, declared or undeclared.
1089 ///
1090 /// For aliases, the target identifier is used as a key for eventual
1091 /// processing when the target is declared. For the single-identifier form,
1092 /// the sole identifier is used as the key. Each entry is a `SetVector`
1093 /// (ordered by parse order) of aliases (identified by the alias name) in case
1094 /// of multiple aliases to the same undeclared identifier.
1095 llvm::MapVector<
1097 llvm::SetVector<
1099 llvm::SmallDenseSet<WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly>>>
1101
1102 /// ExtnameUndeclaredIdentifiers - Identifiers contained in
1103 /// \#pragma redefine_extname before declared. Used in Solaris system headers
1104 /// to define functions that occur in multiple standards to call the version
1105 /// in the currently selected standard.
1106 llvm::DenseMap<IdentifierInfo*,AsmLabelAttr*> ExtnameUndeclaredIdentifiers;
1107
1108
1109 /// Load weak undeclared identifiers from the external source.
1111
1112 /// WeakTopLevelDecl - Translation-unit scoped declarations generated by
1113 /// \#pragma weak during processing of other Decls.
1114 /// I couldn't figure out a clean way to generate these in-line, so
1115 /// we store them here and handle separately -- which is a hack.
1116 /// It would be best to refactor this.
1118
1120
1121 /// Translation Unit Scope - useful to Objective-C actions that need
1122 /// to lookup file scope declarations in the "ordinary" C decl namespace.
1123 /// For example, user-defined classes, built-in "id" type, etc.
1125
1126 /// The C++ "std" namespace, where the standard library resides.
1128
1129 /// The C++ "std::bad_alloc" class, which is defined by the C++
1130 /// standard library.
1132
1133 /// The C++ "std::align_val_t" enum class, which is defined by the C++
1134 /// standard library.
1136
1137 /// The C++ "std::experimental" namespace, where the experimental parts
1138 /// of the standard library resides.
1140
1141 /// The C++ "std::initializer_list" template, which is defined in
1142 /// <initializer_list>.
1144
1145 /// The C++ "std::coroutine_traits" template, which is defined in
1146 /// <coroutine_traits>
1148 /// The namespace where coroutine components are defined. In standard,
1149 /// they are defined in std namespace. And in the previous implementation,
1150 /// they are defined in std::experimental namespace.
1152
1153 /// The C++ "type_info" declaration, which is defined in <typeinfo>.
1155
1156 /// The MSVC "_GUID" struct, which is defined in MSVC header files.
1158
1159 /// The C++ "std::source_location::__impl" struct, defined in
1160 /// <source_location>.
1162
1163 /// Caches identifiers/selectors for NSFoundation APIs.
1164 std::unique_ptr<NSAPI> NSAPIObj;
1165
1166 /// The declaration of the Objective-C NSNumber class.
1168
1169 /// The declaration of the Objective-C NSValue class.
1171
1172 /// Pointer to NSNumber type (NSNumber *).
1174
1175 /// Pointer to NSValue type (NSValue *).
1177
1178 /// The Objective-C NSNumber methods used to create NSNumber literals.
1180
1181 /// The declaration of the Objective-C NSString class.
1183
1184 /// Pointer to NSString type (NSString *).
1186
1187 /// The declaration of the stringWithUTF8String: method.
1189
1190 /// The declaration of the valueWithBytes:objCType: method.
1192
1193 /// The declaration of the Objective-C NSArray class.
1195
1196 /// The declaration of the arrayWithObjects:count: method.
1198
1199 /// The declaration of the Objective-C NSDictionary class.
1201
1202 /// The declaration of the dictionaryWithObjects:forKeys:count: method.
1204
1205 /// id<NSCopying> type.
1207
1208 /// will hold 'respondsToSelector:'
1210
1211 /// A flag to remember whether the implicit forms of operator new and delete
1212 /// have been declared.
1214
1215 /// Describes how the expressions currently being parsed are
1216 /// evaluated at run-time, if at all.
1218 /// The current expression and its subexpressions occur within an
1219 /// unevaluated operand (C++11 [expr]p7), such as the subexpression of
1220 /// \c sizeof, where the type of the expression may be significant but
1221 /// no code will be generated to evaluate the value of the expression at
1222 /// run time.
1224
1225 /// The current expression occurs within a braced-init-list within
1226 /// an unevaluated operand. This is mostly like a regular unevaluated
1227 /// context, except that we still instantiate constexpr functions that are
1228 /// referenced here so that we can perform narrowing checks correctly.
1230
1231 /// The current expression occurs within a discarded statement.
1232 /// This behaves largely similarly to an unevaluated operand in preventing
1233 /// definitions from being required, but not in other ways.
1235
1236 /// The current expression occurs within an unevaluated
1237 /// operand that unconditionally permits abstract references to
1238 /// fields, such as a SIZE operator in MS-style inline assembly.
1240
1241 /// The current context is "potentially evaluated" in C++11 terms,
1242 /// but the expression is evaluated at compile-time (like the values of
1243 /// cases in a switch statement).
1245
1246 /// In addition of being constant evaluated, the current expression
1247 /// occurs in an immediate function context - either a consteval function
1248 /// or a consteval if function.
1250
1251 /// The current expression is potentially evaluated at run time,
1252 /// which means that code may be generated to evaluate the value of the
1253 /// expression at run time.
1255
1256 /// The current expression is potentially evaluated, but any
1257 /// declarations referenced inside that expression are only used if
1258 /// in fact the current expression is used.
1259 ///
1260 /// This value is used when parsing default function arguments, for which
1261 /// we would like to provide diagnostics (e.g., passing non-POD arguments
1262 /// through varargs) but do not want to mark declarations as "referenced"
1263 /// until the default argument is used.
1265 };
1266
1267 using ImmediateInvocationCandidate = llvm::PointerIntPair<ConstantExpr *, 1>;
1268
1269 /// Data structure used to record current or nested
1270 /// expression evaluation contexts.
1272 /// The expression evaluation context.
1274
1275 /// Whether the enclosing context needed a cleanup.
1277
1278 /// The number of active cleanup objects when we entered
1279 /// this expression evaluation context.
1281
1282 /// The number of typos encountered during this expression evaluation
1283 /// context (i.e. the number of TypoExprs created).
1284 unsigned NumTypos;
1285
1287
1288 /// The lambdas that are present within this context, if it
1289 /// is indeed an unevaluated context.
1291
1292 /// The declaration that provides context for lambda expressions
1293 /// and block literals if the normal declaration context does not
1294 /// suffice, e.g., in a default function argument.
1296
1297 /// If we are processing a decltype type, a set of call expressions
1298 /// for which we have deferred checking the completeness of the return type.
1300
1301 /// If we are processing a decltype type, a set of temporary binding
1302 /// expressions for which we have deferred checking the destructor.
1304
1306
1307 /// Expressions appearing as the LHS of a volatile assignment in this
1308 /// context. We produce a warning for these when popping the context if
1309 /// they are not discarded-value expressions nor unevaluated operands.
1311
1312 /// Set of candidates for starting an immediate invocation.
1314
1315 /// Set of DeclRefExprs referencing a consteval function when used in a
1316 /// context not already known to be immediately invoked.
1318
1319 /// \brief Describes whether we are in an expression constext which we have
1320 /// to handle differently.
1324
1325 // A context can be nested in both a discarded statement context and
1326 // an immediate function context, so they need to be tracked independently.
1329
1339
1345
1350
1356
1363 };
1364
1365 /// A stack of expression evaluation contexts.
1367
1368 /// Emit a warning for all pending noderef expressions that we recorded.
1370
1371 /// Compute the mangling number context for a lambda expression or
1372 /// block literal. Also return the extra mangling decl if any.
1373 ///
1374 /// \param DC - The DeclContext containing the lambda expression or
1375 /// block literal.
1376 std::tuple<MangleNumberingContext *, Decl *>
1378
1379
1380 /// SpecialMemberOverloadResult - The overloading result for a special member
1381 /// function.
1382 ///
1383 /// This is basically a wrapper around PointerIntPair. The lowest bits of the
1384 /// integer are used to determine whether overload resolution succeeded.
1386 public:
1392
1393 private:
1394 llvm::PointerIntPair<CXXMethodDecl *, 2> Pair;
1395
1396 public:
1399 : Pair(MD, MD->isDeleted() ? NoMemberOrDeleted : Success) {}
1400
1401 CXXMethodDecl *getMethod() const { return Pair.getPointer(); }
1402 void setMethod(CXXMethodDecl *MD) { Pair.setPointer(MD); }
1403
1404 Kind getKind() const { return static_cast<Kind>(Pair.getInt()); }
1405 void setKind(Kind K) { Pair.setInt(K); }
1406 };
1407
1409 : public llvm::FastFoldingSetNode,
1411 public:
1412 SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
1413 : FastFoldingSetNode(ID)
1414 {}
1415 };
1416
1417 /// A cache of special member function overload resolution results
1418 /// for C++ records.
1419 llvm::FoldingSet<SpecialMemberOverloadResultEntry> SpecialMemberCache;
1420
1421 /// A cache of the flags available in enumerations with the flag_bits
1422 /// attribute.
1423 mutable llvm::DenseMap<const EnumDecl*, llvm::APInt> FlagBitsCache;
1424
1425 /// The kind of translation unit we are processing.
1426 ///
1427 /// When we're processing a complete translation unit, Sema will perform
1428 /// end-of-translation-unit semantic tasks (such as creating
1429 /// initializers for tentative definitions in C) once parsing has
1430 /// completed. Modules and precompiled headers perform different kinds of
1431 /// checks.
1433
1434 llvm::BumpPtrAllocator BumpAlloc;
1435
1436 /// The number of SFINAE diagnostics that have been trapped.
1438
1439 typedef llvm::DenseMap<ParmVarDecl *, llvm::TinyPtrVector<ParmVarDecl *>>
1441
1442 /// A mapping from parameters with unparsed default arguments to the
1443 /// set of instantiations of each parameter.
1444 ///
1445 /// This mapping is a temporary data structure used when parsing
1446 /// nested class templates or nested classes of class templates,
1447 /// where we might end up instantiating an inner class before the
1448 /// default arguments of its methods have been parsed.
1450
1451 // Contains the locations of the beginning of unparsed default
1452 // argument locations.
1453 llvm::DenseMap<ParmVarDecl *, SourceLocation> UnparsedDefaultArgLocs;
1454
1455 /// UndefinedInternals - all the used, undefined objects which require a
1456 /// definition in this translation unit.
1457 llvm::MapVector<NamedDecl *, SourceLocation> UndefinedButUsed;
1458
1459 /// Determine if VD, which must be a variable or function, is an external
1460 /// symbol that nonetheless can't be referenced from outside this translation
1461 /// unit because its type has no linkage and it's not extern "C".
1463
1464 /// Obtain a sorted list of functions that are undefined but ODR-used.
1466 SmallVectorImpl<std::pair<NamedDecl *, SourceLocation> > &Undefined);
1467
1468 /// Retrieves list of suspicious delete-expressions that will be checked at
1469 /// the end of translation unit.
1470 const llvm::MapVector<FieldDecl *, DeleteLocs> &
1472
1474 public:
1475 using Lists = std::pair<ObjCMethodList, ObjCMethodList>;
1476 using iterator = llvm::DenseMap<Selector, Lists>::iterator;
1477 iterator begin() { return Methods.begin(); }
1478 iterator end() { return Methods.end(); }
1479 iterator find(Selector Sel) { return Methods.find(Sel); }
1480 std::pair<iterator, bool> insert(std::pair<Selector, Lists> &&Val) {
1481 return Methods.insert(Val);
1482 }
1483 int count(Selector Sel) const { return Methods.count(Sel); }
1484 bool empty() const { return Methods.empty(); }
1485
1486 private:
1487 llvm::DenseMap<Selector, Lists> Methods;
1488 };
1489
1490 /// Method Pool - allows efficient lookup when typechecking messages to "id".
1491 /// We need to maintain a list, since selectors can have differing signatures
1492 /// across classes. In Cocoa, this happens to be extremely uncommon (only 1%
1493 /// of selectors are "overloaded").
1494 /// At the head of the list it is recorded whether there were 0, 1, or >= 2
1495 /// methods inside categories with a particular selector.
1497
1498 /// Method selectors used in a \@selector expression. Used for implementation
1499 /// of -Wselector.
1500 llvm::MapVector<Selector, SourceLocation> ReferencedSelectors;
1501
1502 /// List of SourceLocations where 'self' is implicitly retained inside a
1503 /// block.
1506
1507 /// Kinds of C++ special members.
1517
1518 typedef llvm::PointerIntPair<CXXRecordDecl *, 3, CXXSpecialMember>
1520
1521 /// The C++ special members which we are currently in the process of
1522 /// declaring. If this process recursively triggers the declaration of the
1523 /// same special member, we should act as if it is not yet declared.
1525
1526 /// Kinds of defaulted comparison operator functions.
1527 enum class DefaultedComparisonKind : unsigned char {
1528 /// This is not a defaultable comparison operator.
1529 None,
1530 /// This is an operator== that should be implemented as a series of
1531 /// subobject comparisons.
1532 Equal,
1533 /// This is an operator<=> that should be implemented as a series of
1534 /// subobject comparisons.
1535 ThreeWay,
1536 /// This is an operator!= that should be implemented as a rewrite in terms
1537 /// of a == comparison.
1538 NotEqual,
1539 /// This is an <, <=, >, or >= that should be implemented as a rewrite in
1540 /// terms of a <=> comparison.
1541 Relational,
1542 };
1543
1544 /// The function definitions which were renamed as part of typo-correction
1545 /// to match their respective declarations. We want to keep track of them
1546 /// to ensure that we don't emit a "redefinition" error if we encounter a
1547 /// correctly named definition after the renamed definition.
1549
1550 /// Stack of types that correspond to the parameter entities that are
1551 /// currently being copy-initialized. Can be empty.
1553
1554 void ReadMethodPool(Selector Sel);
1556
1557 /// Private Helper predicate to check for 'self'.
1558 bool isSelfExpr(Expr *RExpr);
1559 bool isSelfExpr(Expr *RExpr, const ObjCMethodDecl *Method);
1560
1561 /// Cause the active diagnostic on the DiagosticsEngine to be
1562 /// emitted. This is closely coupled to the SemaDiagnosticBuilder class and
1563 /// should not be used elsewhere.
1564 void EmitCurrentDiagnostic(unsigned DiagID);
1565
1566 /// Records and restores the CurFPFeatures state on entry/exit of compound
1567 /// statements.
1569 public:
1572 FPOptionsOverride getOverrides() { return OldOverrides; }
1573
1574 private:
1575 Sema& S;
1576 FPOptions OldFPFeaturesState;
1577 FPOptionsOverride OldOverrides;
1578 LangOptions::FPEvalMethodKind OldEvalMethod;
1579 SourceLocation OldFPPragmaLocation;
1580 };
1581
1582 void addImplicitTypedef(StringRef Name, QualType T);
1583
1585
1586 /// Increment when we find a reference; decrement when we find an ignored
1587 /// assignment. Ultimately the value is 0 if every reference is an ignored
1588 /// assignment.
1589 llvm::DenseMap<const VarDecl *, int> RefsMinusAssignments;
1590
1591 /// Indicate RISC-V vector builtin functions enabled or not.
1593
1594private:
1595 std::unique_ptr<sema::RISCVIntrinsicManager> RVIntrinsicManager;
1596
1597 Optional<std::unique_ptr<DarwinSDKInfo>> CachedDarwinSDKInfo;
1598
1599 bool WarnedDarwinSDKInfoMissing = false;
1600
1601public:
1602 Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
1604 CodeCompleteConsumer *CompletionConsumer = nullptr);
1605 ~Sema();
1606
1607 /// Perform initialization that occurs after the parser has been
1608 /// initialized but before it parses anything.
1609 void Initialize();
1610
1611 /// This virtual key function only exists to limit the emission of debug info
1612 /// describing the Sema class. GCC and Clang only emit debug info for a class
1613 /// with a vtable when the vtable is emitted. Sema is final and not
1614 /// polymorphic, but the debug info size savings are so significant that it is
1615 /// worth adding a vtable just to take advantage of this optimization.
1616 virtual void anchor();
1617
1618 const LangOptions &getLangOpts() const { return LangOpts; }
1621
1624 Preprocessor &getPreprocessor() const { return PP; }
1625 ASTContext &getASTContext() const { return Context; }
1628 ExternalSemaSource* getExternalSource() const { return ExternalSource; }
1629
1631 StringRef Platform);
1633
1634 ///Registers an external source. If an external source already exists,
1635 /// creates a multiplex external source and appends to it.
1636 ///
1637 ///\param[in] E - A non-null external sema source.
1638 ///
1640
1641 void PrintStats() const;
1642
1643 /// Warn that the stack is nearly exhausted.
1645
1646 /// Run some code with "sufficient" stack space. (Currently, at least 256K is
1647 /// guaranteed). Produces a warning if we're low on stack space and allocates
1648 /// more in that case. Use this in code that may recurse deeply (for example,
1649 /// in template instantiation) to avoid stack overflow.
1651 llvm::function_ref<void()> Fn);
1652
1653 /// Helper class that creates diagnostics with optional
1654 /// template instantiation stacks.
1655 ///
1656 /// This class provides a wrapper around the basic DiagnosticBuilder
1657 /// class that emits diagnostics. ImmediateDiagBuilder is
1658 /// responsible for emitting the diagnostic (as DiagnosticBuilder
1659 /// does) and, if the diagnostic comes from inside a template
1660 /// instantiation, printing the template instantiation stack as
1661 /// well.
1663 Sema &SemaRef;
1664 unsigned DiagID;
1665
1666 public:
1667 ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
1668 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1669 ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
1670 : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) {}
1671
1672 // This is a cunning lie. DiagnosticBuilder actually performs move
1673 // construction in its copy constructor (but due to varied uses, it's not
1674 // possible to conveniently express this as actual move construction). So
1675 // the default copy ctor here is fine, because the base class disables the
1676 // source anyway, so the user-defined ~ImmediateDiagBuilder is a safe no-op
1677 // in that case anwyay.
1679
1681 // If we aren't active, there is nothing to do.
1682 if (!isActive()) return;
1683
1684 // Otherwise, we need to emit the diagnostic. First clear the diagnostic
1685 // builder itself so it won't emit the diagnostic in its own destructor.
1686 //
1687 // This seems wasteful, in that as written the DiagnosticBuilder dtor will
1688 // do its own needless checks to see if the diagnostic needs to be
1689 // emitted. However, because we take care to ensure that the builder
1690 // objects never escape, a sufficiently smart compiler will be able to
1691 // eliminate that code.
1692 Clear();
1693
1694 // Dispatch to Sema to emit the diagnostic.
1695 SemaRef.EmitCurrentDiagnostic(DiagID);
1696 }
1697
1698 /// Teach operator<< to produce an object of the correct type.
1699 template <typename T>
1701 operator<<(const ImmediateDiagBuilder &Diag, const T &Value) {
1702 const DiagnosticBuilder &BaseDiag = Diag;
1703 BaseDiag << Value;
1704 return Diag;
1705 }
1706
1707 // It is necessary to limit this to rvalue reference to avoid calling this
1708 // function with a bitfield lvalue argument since non-const reference to
1709 // bitfield is not allowed.
1710 template <typename T, typename = typename std::enable_if<
1711 !std::is_lvalue_reference<T>::value>::type>
1713 const DiagnosticBuilder &BaseDiag = *this;
1714 BaseDiag << std::move(V);
1715 return *this;
1716 }
1717 };
1718
1719 /// A generic diagnostic builder for errors which may or may not be deferred.
1720 ///
1721 /// In CUDA, there exist constructs (e.g. variable-length arrays, try/catch)
1722 /// which are not allowed to appear inside __device__ functions and are
1723 /// allowed to appear in __host__ __device__ functions only if the host+device
1724 /// function is never codegen'ed.
1725 ///
1726 /// To handle this, we use the notion of "deferred diagnostics", where we
1727 /// attach a diagnostic to a FunctionDecl that's emitted iff it's codegen'ed.
1728 ///
1729 /// This class lets you emit either a regular diagnostic, a deferred
1730 /// diagnostic, or no diagnostic at all, according to an argument you pass to
1731 /// its constructor, thus simplifying the process of creating these "maybe
1732 /// deferred" diagnostics.
1734 public:
1735 enum Kind {
1736 /// Emit no diagnostics.
1738 /// Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
1740 /// Emit the diagnostic immediately, and, if it's a warning or error, also
1741 /// emit a call stack showing how this function can be reached by an a
1742 /// priori known-emitted function.
1744 /// Create a deferred diagnostic, which is emitted only if the function
1745 /// it's attached to is codegen'ed. Also emit a call stack as with
1746 /// K_ImmediateWithCallStack.
1749
1750 SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID,
1751 FunctionDecl *Fn, Sema &S);
1755
1756 bool isImmediate() const { return ImmediateDiag.has_value(); }
1757
1758 /// Convertible to bool: True if we immediately emitted an error, false if
1759 /// we didn't emit an error or we created a deferred error.
1760 ///
1761 /// Example usage:
1762 ///
1763 /// if (SemaDiagnosticBuilder(...) << foo << bar)
1764 /// return ExprError();
1765 ///
1766 /// But see CUDADiagIfDeviceCode() and CUDADiagIfHostCode() -- you probably
1767 /// want to use these instead of creating a SemaDiagnosticBuilder yourself.
1768 operator bool() const { return isImmediate(); }
1769
1770 template <typename T>
1772 operator<<(const SemaDiagnosticBuilder &Diag, const T &Value) {
1773 if (Diag.ImmediateDiag)
1774 *Diag.ImmediateDiag << Value;
1775 else if (Diag.PartialDiagId)
1776 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second
1777 << Value;
1778 return Diag;
1779 }
1780
1781 // It is necessary to limit this to rvalue reference to avoid calling this
1782 // function with a bitfield lvalue argument since non-const reference to
1783 // bitfield is not allowed.
1784 template <typename T, typename = typename std::enable_if<
1785 !std::is_lvalue_reference<T>::value>::type>
1787 if (ImmediateDiag)
1788 *ImmediateDiag << std::move(V);
1789 else if (PartialDiagId)
1790 S.DeviceDeferredDiags[Fn][*PartialDiagId].second << std::move(V);
1791 return *this;
1792 }
1793
1796 if (Diag.ImmediateDiag)
1797 PD.Emit(*Diag.ImmediateDiag);
1798 else if (Diag.PartialDiagId)
1799 Diag.S.DeviceDeferredDiags[Diag.Fn][*Diag.PartialDiagId].second = PD;
1800 return Diag;
1801 }
1802
1803 void AddFixItHint(const FixItHint &Hint) const {
1804 if (ImmediateDiag)
1805 ImmediateDiag->AddFixItHint(Hint);
1806 else if (PartialDiagId)
1807 S.DeviceDeferredDiags[Fn][*PartialDiagId].second.AddFixItHint(Hint);
1808 }
1809
1811 return ExprError();
1812 }
1814 return StmtError();
1815 }
1816 operator ExprResult() const { return ExprError(); }
1817 operator StmtResult() const { return StmtError(); }
1818 operator TypeResult() const { return TypeError(); }
1819 operator DeclResult() const { return DeclResult(true); }
1820 operator MemInitResult() const { return MemInitResult(true); }
1821
1822 private:
1823 Sema &S;
1824 SourceLocation Loc;
1825 unsigned DiagID;
1826 FunctionDecl *Fn;
1827 bool ShowCallStack;
1828
1829 // Invariant: At most one of these Optionals has a value.
1830 // FIXME: Switch these to a Variant once that exists.
1832 llvm::Optional<unsigned> PartialDiagId;
1833 };
1834
1835 /// Is the last error level diagnostic immediate. This is used to determined
1836 /// whether the next info diagnostic should be immediate.
1838
1839 /// Emit a diagnostic.
1840 SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID,
1841 bool DeferHint = false);
1842
1843 /// Emit a partial diagnostic.
1845 bool DeferHint = false);
1846
1847 /// Build a partial diagnostic.
1848 PartialDiagnostic PDiag(unsigned DiagID = 0); // in SemaInternal.h
1849
1850 /// Whether deferrable diagnostics should be deferred.
1851 bool DeferDiags = false;
1852
1853 /// RAII class to control scope of DeferDiags.
1855 Sema &S;
1856 bool SavedDeferDiags = false;
1857
1858 public:
1860 : S(S), SavedDeferDiags(S.DeferDiags) {
1861 S.DeferDiags = DeferDiags;
1862 }
1863 ~DeferDiagsRAII() { S.DeferDiags = SavedDeferDiags; }
1864 };
1865
1866 /// Whether uncompilable error has occurred. This includes error happens
1867 /// in deferred diagnostics.
1868 bool hasUncompilableErrorOccurred() const;
1869
1870 bool findMacroSpelling(SourceLocation &loc, StringRef name);
1871
1872 /// Get a string to suggest for zero-initialization of a type.
1873 std::string
1875 std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const;
1876
1877 /// Calls \c Lexer::getLocForEndOfToken()
1879
1880 /// Retrieve the module loader associated with the preprocessor.
1882
1883 /// Invent a new identifier for parameters of abbreviated templates.
1886 unsigned Index);
1887
1889
1890 private:
1891 /// Function or variable declarations to be checked for whether the deferred
1892 /// diagnostics should be emitted.
1893 llvm::SmallSetVector<Decl *, 4> DeclsToCheckForDeferredDiags;
1894
1895 public:
1896 // Emit all deferred diagnostics.
1897 void emitDeferredDiags();
1898
1900 /// The global module fragment, between 'module;' and a module-declaration.
1902 /// A normal translation unit fragment. For a non-module unit, this is the
1903 /// entire translation unit. Otherwise, it runs from the module-declaration
1904 /// to the private-module-fragment (if any) or the end of the TU (if not).
1906 /// The private module fragment, between 'module :private;' and the end of
1907 /// the translation unit.
1908 Private
1910
1914
1916
1918
1919 void PushFunctionScope();
1920 void PushBlockScope(Scope *BlockScope, BlockDecl *Block);
1922
1923 /// This is used to inform Sema what the current TemplateParameterDepth
1924 /// is during Parsing. Currently it is used to pass on the depth
1925 /// when parsing generic lambda 'auto' parameters.
1926 void RecordParsingTemplateParameterDepth(unsigned Depth);
1927
1928 void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD,
1930 unsigned OpenMPCaptureLevel = 0);
1931
1932 /// Custom deleter to allow FunctionScopeInfos to be kept alive for a short
1933 /// time after they've been popped.
1935 Sema *Self;
1936
1937 public:
1938 explicit PoppedFunctionScopeDeleter(Sema *Self) : Self(Self) {}
1940 };
1941
1943 std::unique_ptr<sema::FunctionScopeInfo, PoppedFunctionScopeDeleter>;
1944
1947 const Decl *D = nullptr,
1948 QualType BlockType = QualType());
1949
1951 return FunctionScopes.empty() ? nullptr : FunctionScopes.back();
1952 }
1953
1955
1960
1961 void PushCompoundScope(bool IsStmtExpr);
1962 void PopCompoundScope();
1963
1965
1967
1968 /// Retrieve the current block, if any.
1970
1971 /// Get the innermost lambda enclosing the current location, if any. This
1972 /// looks through intervening non-lambda scopes such as local functions and
1973 /// blocks.
1975
1976 /// Retrieve the current lambda scope info, if any.
1977 /// \param IgnoreNonLambdaCapturingScope true if should find the top-most
1978 /// lambda scope info ignoring all inner capturing scopes that are not
1979 /// lambda scopes.
1981 getCurLambda(bool IgnoreNonLambdaCapturingScope = false);
1982
1983 /// Retrieve the current generic lambda info, if any.
1985
1986 /// Retrieve the current captured region, if any.
1988
1989 /// Retrieve the current function, if any, that should be analyzed for
1990 /// potential availability violations.
1992
1993 /// WeakTopLevelDeclDecls - access to \#pragma weak-generated Decls
1995
1996 /// Called before parsing a function declarator belonging to a function
1997 /// declaration.
1999 unsigned TemplateParameterDepth);
2000
2001 /// Called after parsing a function declarator belonging to a function
2002 /// declaration.
2004
2005 void ActOnComment(SourceRange Comment);
2006
2007 //===--------------------------------------------------------------------===//
2008 // Type Analysis / Processing: SemaType.cpp.
2009 //
2010
2012 const DeclSpec *DS = nullptr);
2013 QualType BuildQualifiedType(QualType T, SourceLocation Loc, unsigned CVRA,
2014 const DeclSpec *DS = nullptr);
2016 SourceLocation Loc, DeclarationName Entity);
2017 QualType BuildReferenceType(QualType T, bool LValueRef,
2018 SourceLocation Loc, DeclarationName Entity);
2020 Expr *ArraySize, unsigned Quals,
2021 SourceRange Brackets, DeclarationName Entity);
2022 QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc);
2024 SourceLocation AttrLoc);
2025 QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns,
2026 SourceLocation AttrLoc);
2027
2028 QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace,
2029 SourceLocation AttrLoc);
2030
2031 /// Same as above, but constructs the AddressSpace index if not provided.
2033 SourceLocation AttrLoc);
2034
2036
2038
2039 /// Build a function type.
2040 ///
2041 /// This routine checks the function type according to C++ rules and
2042 /// under the assumption that the result type and parameter types have
2043 /// just been instantiated from a template. It therefore duplicates
2044 /// some of the behavior of GetTypeForDeclarator, but in a much
2045 /// simpler form that is only suitable for this narrow use case.
2046 ///
2047 /// \param T The return type of the function.
2048 ///
2049 /// \param ParamTypes The parameter types of the function. This array
2050 /// will be modified to account for adjustments to the types of the
2051 /// function parameters.
2052 ///
2053 /// \param Loc The location of the entity whose type involves this
2054 /// function type or, if there is no such entity, the location of the
2055 /// type that will have function type.
2056 ///
2057 /// \param Entity The name of the entity that involves the function
2058 /// type, if known.
2059 ///
2060 /// \param EPI Extra information about the function type. Usually this will
2061 /// be taken from an existing function with the same prototype.
2062 ///
2063 /// \returns A suitable function type, if there are no errors. The
2064 /// unqualified type will always be a FunctionProtoType.
2065 /// Otherwise, returns a NULL type.
2067 MutableArrayRef<QualType> ParamTypes,
2068 SourceLocation Loc, DeclarationName Entity,
2070
2072 SourceLocation Loc,
2073 DeclarationName Entity);
2075 SourceLocation Loc, DeclarationName Entity);
2079 SourceLocation Loc);
2081 SourceLocation Loc);
2082 QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc);
2083
2086
2087 /// Package the given type and TSI into a ParsedType.
2092 TypeSourceInfo **TInfo = nullptr);
2093 CanThrowResult canThrow(const Stmt *E);
2094 /// Determine whether the callee of a particular function call can throw.
2095 /// E, D and Loc are all optional.
2096 static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D,
2099 const FunctionProtoType *FPT);
2106 const FunctionProtoType *Old, SourceLocation OldLoc,
2107 const FunctionProtoType *New, SourceLocation NewLoc);
2109 const PartialDiagnostic &DiagID, const PartialDiagnostic & NoteID,
2110 const FunctionProtoType *Old, SourceLocation OldLoc,
2111 const FunctionProtoType *New, SourceLocation NewLoc);
2112 bool handlerCanCatch(QualType HandlerType, QualType ExceptionType);
2114 const PartialDiagnostic &NestedDiagID,
2115 const PartialDiagnostic &NoteID,
2116 const PartialDiagnostic &NoThrowDiagID,
2117 const FunctionProtoType *Superset,
2118 SourceLocation SuperLoc,
2119 const FunctionProtoType *Subset,
2120 SourceLocation SubLoc);
2121 bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID,
2122 const PartialDiagnostic &NoteID,
2123 const FunctionProtoType *Target,
2124 SourceLocation TargetLoc,
2125 const FunctionProtoType *Source,
2126 SourceLocation SourceLoc);
2127
2129
2130 /// The parser has parsed the context-sensitive type 'instancetype'
2131 /// in an Objective-C message declaration. Return the appropriate type.
2133
2134 /// Abstract class used to diagnose incomplete types.
2137
2138 virtual void diagnose(Sema &S, SourceLocation Loc, QualType T) = 0;
2139 virtual ~TypeDiagnoser() {}
2140 };
2141
2142 static int getPrintable(int I) { return I; }
2143 static unsigned getPrintable(unsigned I) { return I; }
2144 static bool getPrintable(bool B) { return B; }
2145 static const char * getPrintable(const char *S) { return S; }
2146 static StringRef getPrintable(StringRef S) { return S; }
2147 static const std::string &getPrintable(const std::string &S) { return S; }
2148 static const IdentifierInfo *getPrintable(const IdentifierInfo *II) {
2149 return II;
2150 }
2152 static QualType getPrintable(QualType T) { return T; }
2153 static SourceRange getPrintable(SourceRange R) { return R; }
2155 static SourceRange getPrintable(const Expr *E) { return E->getSourceRange(); }
2157
2158 template <typename... Ts> class BoundTypeDiagnoser : public TypeDiagnoser {
2159 protected:
2160 unsigned DiagID;
2161 std::tuple<const Ts &...> Args;
2162
2163 template <std::size_t... Is>
2165 std::index_sequence<Is...>) const {
2166 // Apply all tuple elements to the builder in order.
2167 bool Dummy[] = {false, (DB << getPrintable(std::get<Is>(Args)))...};
2168 (void)Dummy;
2169 }
2170
2171 public:
2172 BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
2173 : TypeDiagnoser(), DiagID(DiagID), Args(Args...) {
2174 assert(DiagID != 0 && "no diagnostic for type diagnoser");
2175 }
2176
2177 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2178 const SemaDiagnosticBuilder &DB = S.Diag(Loc, DiagID);
2179 emit(DB, std::index_sequence_for<Ts...>());
2180 DB << T;
2181 }
2182 };
2183
2184 /// Do a check to make sure \p Name looks like a legal argument for the
2185 /// swift_name attribute applied to decl \p D. Raise a diagnostic if the name
2186 /// is invalid for the given declaration.
2187 ///
2188 /// \p AL is used to provide caret diagnostics in case of a malformed name.
2189 ///
2190 /// \returns true if the name is a valid swift name for \p D, false otherwise.
2191 bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc,
2192 const ParsedAttr &AL, bool IsAsync);
2193
2194 /// A derivative of BoundTypeDiagnoser for which the diagnostic's type
2195 /// parameter is preceded by a 0/1 enum that is 1 if the type is sizeless.
2196 /// For example, a diagnostic with no other parameters would generally have
2197 /// the form "...%select{incomplete|sizeless}0 type %1...".
2198 template <typename... Ts>
2200 public:
2201 SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
2202 : BoundTypeDiagnoser<Ts...>(DiagID, Args...) {}
2203
2204 void diagnose(Sema &S, SourceLocation Loc, QualType T) override {
2205 const SemaDiagnosticBuilder &DB = S.Diag(Loc, this->DiagID);
2206 this->emit(DB, std::index_sequence_for<Ts...>());
2207 DB << T->isSizelessType() << T;
2208 }
2209 };
2210
2211 enum class CompleteTypeKind {
2212 /// Apply the normal rules for complete types. In particular,
2213 /// treat all sizeless types as incomplete.
2214 Normal,
2215
2216 /// Relax the normal rules for complete types so that they include
2217 /// sizeless built-in types.
2219
2220 // FIXME: Eventually we should flip the default to Normal and opt in
2221 // to AcceptSizeless rather than opt out of it.
2223 };
2224
2226
2227private:
2228 /// Methods for marking which expressions involve dereferencing a pointer
2229 /// marked with the 'noderef' attribute. Expressions are checked bottom up as
2230 /// they are parsed, meaning that a noderef pointer may not be accessed. For
2231 /// example, in `&*p` where `p` is a noderef pointer, we will first parse the
2232 /// `*p`, but need to check that `address of` is called on it. This requires
2233 /// keeping a container of all pending expressions and checking if the address
2234 /// of them are eventually taken.
2235 void CheckSubscriptAccessOfNoDeref(const ArraySubscriptExpr *E);
2236 void CheckAddressOfNoDeref(const Expr *E);
2237 void CheckMemberAccessOfNoDeref(const MemberExpr *E);
2238
2239 bool RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
2240 CompleteTypeKind Kind, TypeDiagnoser *Diagnoser);
2241
2242 struct ModuleScope {
2243 SourceLocation BeginLoc;
2244 clang::Module *Module = nullptr;
2245 bool ModuleInterface = false;
2246 bool IsPartition = false;
2247 bool ImplicitGlobalModuleFragment = false;
2248 VisibleModuleSet OuterVisibleModules;
2249 };
2250 /// The modules we're currently parsing.
2252 /// The global module fragment of the current translation unit.
2253 clang::Module *GlobalModuleFragment = nullptr;
2254
2255 /// The modules we imported directly.
2256 llvm::SmallPtrSet<clang::Module *, 8> DirectModuleImports;
2257
2258 /// Namespace definitions that we will export when they finish.
2259 llvm::SmallPtrSet<const NamespaceDecl*, 8> DeferredExportedNamespaces;
2260
2261 /// Helper function to judge if we are in module purview.
2262 /// Return false if we are not in a module.
2263 bool isCurrentModulePurview() const {
2264 return getCurrentModule() ? getCurrentModule()->isModulePurview() : false;
2265 }
2266
2267 /// Enter the scope of the global module.
2268 Module *PushGlobalModuleFragment(SourceLocation BeginLoc, bool IsImplicit);
2269 /// Leave the scope of the global module.
2270 void PopGlobalModuleFragment();
2271
2272 VisibleModuleSet VisibleModules;
2273
2274 /// Cache for module units which is usable for current module.
2275 llvm::DenseSet<const Module *> UsableModuleUnitsCache;
2276
2277 bool isUsableModule(const Module *M);
2278
2279 bool isAcceptableSlow(const NamedDecl *D, AcceptableKind Kind);
2280
2281 // Determine whether the module M belongs to the current TU.
2282 bool isModuleUnitOfCurrentTU(const Module *M) const;
2283
2284public:
2285 /// Get the module unit whose scope we are currently within.
2287 return ModuleScopes.empty() ? nullptr : ModuleScopes.back().Module;
2288 }
2289
2290 /// Is the module scope we are an interface?
2292 return ModuleScopes.empty() ? false : ModuleScopes.back().ModuleInterface;
2293 }
2294
2295 /// Get the module owning an entity.
2296 Module *getOwningModule(const Decl *Entity) {
2297 return Entity->getOwningModule();
2298 }
2299
2301 return DirectModuleImports.contains(M);
2302 }
2303
2304 /// Make a merged definition of an existing hidden definition \p ND
2305 /// visible at the specified location.
2307
2308 bool isModuleVisible(const Module *M, bool ModulePrivate = false);
2309
2310 // When loading a non-modular PCH files, this is used to restore module
2311 // visibility.
2313 VisibleModules.setVisible(Mod, ImportLoc);
2314 }
2315
2316 /// Determine whether a declaration is visible to name lookup.
2317 bool isVisible(const NamedDecl *D) {
2318 return D->isUnconditionallyVisible() ||
2319 isAcceptableSlow(D, AcceptableKind::Visible);
2320 }
2321
2322 /// Determine whether a declaration is reachable.
2323 bool isReachable(const NamedDecl *D) {
2324 // All visible declarations are reachable.
2325 return D->isUnconditionallyVisible() ||
2326 isAcceptableSlow(D, AcceptableKind::Reachable);
2327 }
2328
2329 /// Determine whether a declaration is acceptable (visible/reachable).
2331 return Kind == AcceptableKind::Visible ? isVisible(D) : isReachable(D);
2332 }
2333
2334 /// Determine whether any declaration of an entity is visible.
2335 bool
2337 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
2338 return isVisible(D) || hasVisibleDeclarationSlow(D, Modules);
2339 }
2340
2343 /// Determine whether any declaration of an entity is reachable.
2344 bool
2346 llvm::SmallVectorImpl<Module *> *Modules = nullptr) {
2347 return isReachable(D) || hasReachableDeclarationSlow(D, Modules);
2348 }
2350 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2351
2354
2355 /// Determine if \p D and \p Suggested have a structurally compatible
2356 /// layout as described in C11 6.2.7/1.
2357 bool hasStructuralCompatLayout(Decl *D, Decl *Suggested);
2358
2359 /// Determine if \p D has a visible definition. If not, suggest a declaration
2360 /// that should be made visible to expose the definition.
2361 bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested,
2362 bool OnlyNeedComplete = false);
2364 NamedDecl *Hidden;
2365 return hasVisibleDefinition(const_cast<NamedDecl*>(D), &Hidden);
2366 }
2367
2368 /// Determine if \p D has a reachable definition. If not, suggest a
2369 /// declaration that should be made reachable to expose the definition.
2370 bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested,
2371 bool OnlyNeedComplete = false);
2373 NamedDecl *Hidden;
2374 return hasReachableDefinition(D, &Hidden);
2375 }
2376
2377 bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested,
2378 AcceptableKind Kind,
2379 bool OnlyNeedComplete = false);
2381 NamedDecl *Hidden;
2382 return hasAcceptableDefinition(D, &Hidden, Kind);
2383 }
2384
2385 /// Determine if the template parameter \p D has a visible default argument.
2386 bool
2388 llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2389 /// Determine if the template parameter \p D has a reachable default argument.
2391 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2392 /// Determine if the template parameter \p D has a reachable default argument.
2396
2397 /// Determine if there is a visible declaration of \p D that is an explicit
2398 /// specialization declaration for a specialization of a template. (For a
2399 /// member specialization, use hasVisibleMemberSpecialization.)
2401 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2402 /// Determine if there is a reachable declaration of \p D that is an explicit
2403 /// specialization declaration for a specialization of a template. (For a
2404 /// member specialization, use hasReachableMemberSpecialization.)
2406 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2407
2408 /// Determine if there is a visible declaration of \p D that is a member
2409 /// specialization declaration (as opposed to an instantiated declaration).
2411 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2412 /// Determine if there is a reachable declaration of \p D that is a member
2413 /// specialization declaration (as opposed to an instantiated declaration).
2415 const NamedDecl *D, llvm::SmallVectorImpl<Module *> *Modules = nullptr);
2416
2417 /// Determine if \p A and \p B are equivalent internal linkage declarations
2418 /// from different modules, and thus an ambiguity error can be downgraded to
2419 /// an extension warning.
2421 const NamedDecl *B);
2423 SourceLocation Loc, const NamedDecl *D,
2425
2427
2430 return !RequireCompleteTypeImpl(Loc, T, Kind, nullptr);
2431 }
2433 CompleteTypeKind Kind, TypeDiagnoser &Diagnoser);
2435 CompleteTypeKind Kind, unsigned DiagID);
2436
2438 TypeDiagnoser &Diagnoser) {
2439 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, Diagnoser);
2440 }
2441 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID) {
2442 return RequireCompleteType(Loc, T, CompleteTypeKind::Default, DiagID);
2443 }
2444
2445 template <typename... Ts>
2446 bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID,
2447 const Ts &...Args) {
2448 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2449 return RequireCompleteType(Loc, T, Diagnoser);
2450 }
2451
2452 template <typename... Ts>
2454 const Ts &... Args) {
2455 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2456 return RequireCompleteType(Loc, T, CompleteTypeKind::Normal, Diagnoser);
2457 }
2458
2459 /// Get the type of expression E, triggering instantiation to complete the
2460 /// type if necessary -- that is, if the expression refers to a templated
2461 /// static data member of incomplete array type.
2462 ///
2463 /// May still return an incomplete type if instantiation was not possible or
2464 /// if the type is incomplete for a different reason. Use
2465 /// RequireCompleteExprType instead if a diagnostic is expected for an
2466 /// incomplete expression type.
2468
2471 TypeDiagnoser &Diagnoser);
2472 bool RequireCompleteExprType(Expr *E, unsigned DiagID);
2473
2474 template <typename... Ts>
2475 bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args) {
2476 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2478 }
2479
2480 template <typename... Ts>
2481 bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID,
2482 const Ts &... Args) {
2483 SizelessTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2485 }
2486
2488 TypeDiagnoser &Diagnoser);
2489 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID);
2490
2491 template <typename... Ts>
2492 bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID,
2493 const Ts &...Args) {
2494 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
2495 return RequireLiteralType(Loc, T, Diagnoser);
2496 }
2497
2499 const CXXScopeSpec &SS, QualType T,
2500 TagDecl *OwnedTagDecl = nullptr);
2501
2502 // Returns the underlying type of a decltype with the given expression.
2504
2506 /// If AsUnevaluated is false, E is treated as though it were an evaluated
2507 /// context, such as when building a type for decltype(auto).
2508 QualType BuildDecltypeType(Expr *E, bool AsUnevaluated = true);
2511 SourceLocation Loc);
2512
2513 //===--------------------------------------------------------------------===//
2514 // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
2515 //
2516
2526
2527 DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
2528
2530
2531 bool isSimpleTypeSpecifier(tok::TokenKind Kind) const;
2532
2534 Scope *S, CXXScopeSpec *SS = nullptr,
2535 bool isClassName = false, bool HasTrailingDot = false,
2536 ParsedType ObjectType = nullptr,
2537 bool IsCtorOrDtorName = false,
2538 bool WantNontrivialTypeSourceInfo = false,
2539 bool IsClassTemplateDeductionContext = true,
2540 IdentifierInfo **CorrectedII = nullptr);
2542 bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S);
2544 SourceLocation IILoc,
2545 Scope *S,
2546 CXXScopeSpec *SS,
2547 ParsedType &SuggestedType,
2548 bool IsTemplateName = false);
2549
2550 /// Attempt to behave like MSVC in situations where lookup of an unqualified
2551 /// type name has failed in a dependent context. In these situations, we
2552 /// automatically form a DependentTypeName that will retry lookup in a related
2553 /// scope during instantiation.
2555 SourceLocation NameLoc,
2556 bool IsTemplateTypeArg);
2557
2558 /// Describes the result of the name lookup and resolution performed
2559 /// by \c ClassifyName().
2561 /// This name is not a type or template in this context, but might be
2562 /// something else.
2564 /// Classification failed; an error has been produced.
2566 /// The name has been typo-corrected to a keyword.
2568 /// The name was classified as a type.
2570 /// The name was classified as a specific non-type, non-template
2571 /// declaration. ActOnNameClassifiedAsNonType should be called to
2572 /// convert the declaration to an expression.
2574 /// The name was classified as an ADL-only function name.
2575 /// ActOnNameClassifiedAsUndeclaredNonType should be called to convert the
2576 /// result to an expression.
2578 /// The name denotes a member of a dependent type that could not be
2579 /// resolved. ActOnNameClassifiedAsDependentNonType should be called to
2580 /// convert the result to an expression.
2582 /// The name was classified as an overload set, and an expression
2583 /// representing that overload set has been formed.
2584 /// ActOnNameClassifiedAsOverloadSet should be called to form a suitable
2585 /// expression referencing the overload set.
2587 /// The name was classified as a template whose specializations are types.
2589 /// The name was classified as a variable template name.
2591 /// The name was classified as a function template name.
2593 /// The name was classified as an ADL-only function template name.
2595 /// The name was classified as a concept name.
2597 };
2598
2601 union {
2606 };
2607
2608 explicit NameClassification(NameClassificationKind Kind) : Kind(Kind) {}
2609
2610 public:
2612
2614
2617 }
2618
2622
2625 Result.Expr = E;
2626 return Result;
2627 }
2628
2631 Result.NonTypeDecl = D;
2632 return Result;
2633 }
2634
2638
2642
2645 Result.Template = Name;
2646 return Result;
2647 }
2648
2651 Result.Template = Name;
2652 return Result;
2653 }
2654
2657 Result.Template = Name;
2658 return Result;
2659 }
2660
2663 Result.Template = Name;
2664 return Result;
2665 }
2666
2672
2673 NameClassificationKind getKind() const { return Kind; }
2674
2676 assert(Kind == NC_OverloadSet);
2677 return Expr;
2678 }
2679
2681 assert(Kind == NC_Type);
2682 return Type;
2683 }
2684
2686 assert(Kind == NC_NonType);
2687 return NonTypeDecl;
2688 }
2689
2691 assert(Kind == NC_TypeTemplate || Kind == NC_FunctionTemplate ||
2692 Kind == NC_VarTemplate || Kind == NC_Concept ||
2693 Kind == NC_UndeclaredTemplate);
2694 return Template;
2695 }
2696
2698 switch (Kind) {
2699 case NC_TypeTemplate:
2700 return TNK_Type_template;
2702 return TNK_Function_template;
2703 case NC_VarTemplate:
2704 return TNK_Var_template;
2705 case NC_Concept:
2706 return TNK_Concept_template;
2709 default:
2710 llvm_unreachable("unsupported name classification.");
2711 }
2712 }
2713 };
2714
2715 /// Perform name lookup on the given name, classifying it based on
2716 /// the results of name lookup and the following token.
2717 ///
2718 /// This routine is used by the parser to resolve identifiers and help direct
2719 /// parsing. When the identifier cannot be found, this routine will attempt
2720 /// to correct the typo and classify based on the resulting name.
2721 ///
2722 /// \param S The scope in which we're performing name lookup.
2723 ///
2724 /// \param SS The nested-name-specifier that precedes the name.
2725 ///
2726 /// \param Name The identifier. If typo correction finds an alternative name,
2727 /// this pointer parameter will be updated accordingly.
2728 ///
2729 /// \param NameLoc The location of the identifier.
2730 ///
2731 /// \param NextToken The token following the identifier. Used to help
2732 /// disambiguate the name.
2733 ///
2734 /// \param CCC The correction callback, if typo correction is desired.
2735 NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS,
2736 IdentifierInfo *&Name, SourceLocation NameLoc,
2737 const Token &NextToken,
2738 CorrectionCandidateCallback *CCC = nullptr);
2739
2740 /// Act on the result of classifying a name as an undeclared (ADL-only)
2741 /// non-type declaration.
2743 SourceLocation NameLoc);
2744 /// Act on the result of classifying a name as an undeclared member of a
2745 /// dependent base class.
2747 IdentifierInfo *Name,
2748 SourceLocation NameLoc,
2749 bool IsAddressOfOperand);
2750 /// Act on the result of classifying a name as a specific non-type
2751 /// declaration.
2753 NamedDecl *Found,
2754 SourceLocation NameLoc,
2755 const Token &NextToken);
2756 /// Act on the result of classifying a name as an overload set.
2758
2759 /// Describes the detailed kind of a template name. Used in diagnostics.
2771
2772 /// Determine whether it's plausible that E was intended to be a
2773 /// template-name.
2775 if (!getLangOpts().CPlusPlus || E.isInvalid())
2776 return false;
2777 Dependent = false;
2778 if (auto *DRE = dyn_cast<DeclRefExpr>(E.get()))
2779 return !DRE->hasExplicitTemplateArgs();
2780 if (auto *ME = dyn_cast<MemberExpr>(E.get()))
2781 return !ME->hasExplicitTemplateArgs();
2782 Dependent = true;
2783 if (auto *DSDRE = dyn_cast<DependentScopeDeclRefExpr>(E.get()))
2784 return !DSDRE->hasExplicitTemplateArgs();
2785 if (auto *DSME = dyn_cast<CXXDependentScopeMemberExpr>(E.get()))
2786 return !DSME->hasExplicitTemplateArgs();
2787 // Any additional cases recognized here should also be handled by
2788 // diagnoseExprIntendedAsTemplateName.
2789 return false;
2790 }
2794
2795 void warnOnReservedIdentifier(const NamedDecl *D);
2796
2798
2800 MultiTemplateParamsArg TemplateParameterLists);
2802 QualType &T, SourceLocation Loc,
2803 unsigned FailedFoldDiagID);
2808 bool IsTemplateId);
2809 void
2810 diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals,
2811 SourceLocation FallbackLoc,
2812 SourceLocation ConstQualLoc = SourceLocation(),
2813 SourceLocation VolatileQualLoc = SourceLocation(),
2814 SourceLocation RestrictQualLoc = SourceLocation(),
2815 SourceLocation AtomicQualLoc = SourceLocation(),
2816 SourceLocation UnalignedQualLoc = SourceLocation());
2817
2819 void DiagnoseFunctionSpecifiers(const DeclSpec &DS);
2821 const LookupResult &R);
2824 const LookupResult &R);
2825 void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl,
2826 const LookupResult &R);
2827 void CheckShadow(Scope *S, VarDecl *D);
2828
2829 /// Warn if 'E', which is an expression that is about to be modified, refers
2830 /// to a shadowing declaration.
2832
2834
2835private:
2836 /// Map of current shadowing declarations to shadowed declarations. Warn if
2837 /// it looks like the user is trying to modify the shadowing declaration.
2838 llvm::DenseMap<const NamedDecl *, const NamedDecl *> ShadowingDecls;
2839
2840public:
2841 void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange);
2842 void handleTagNumbering(const TagDecl *Tag, Scope *TagScope);
2843 void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
2844 TypedefNameDecl *NewTD);
2847 TypeSourceInfo *TInfo,
2850 LookupResult &Previous, bool &Redeclaration);
2852 TypeSourceInfo *TInfo,
2854 MultiTemplateParamsArg TemplateParamLists,
2855 bool &AddToScope,
2857 NamedDecl *
2859 MultiTemplateParamsArg TemplateParamLists);
2860 // Returns true if the variable declaration is a redeclaration
2864 Expr *Init);
2868
2870 TypeSourceInfo *TInfo,
2872 MultiTemplateParamsArg TemplateParamLists,
2873 bool &AddToScope);
2875
2877 /// Diagnose issues that are non-constant or that are extensions.
2878 Diagnose,
2879 /// Identify whether this function satisfies the formal rules for constexpr
2880 /// functions in the current lanugage mode (with no extensions).
2882 };
2883
2885 CheckConstexprKind Kind);
2886
2889 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2891 SmallVectorImpl<CXXMethodDecl*> &OverloadedMethods);
2892 // Returns true if the function declaration is a redeclaration
2895 bool IsMemberSpecialization, bool DeclIsDefn);
2898 QualType NewT, QualType OldT);
2899 void CheckMain(FunctionDecl *FD, const DeclSpec &D);
2902 bool IsDefinition);
2906 SourceLocation Loc,
2907 QualType T);
2909 SourceLocation NameLoc, IdentifierInfo *Name,
2910 QualType T, TypeSourceInfo *TSInfo,
2911 StorageClass SC);
2912 void ActOnParamDefaultArgument(Decl *param,
2913 SourceLocation EqualLoc,
2914 Expr *defarg);
2916 SourceLocation ArgLoc);
2917 void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc);
2919 SourceLocation EqualLoc);
2920 void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
2921 SourceLocation EqualLoc);
2922
2923 // Contexts where using non-trivial C union types can be disallowed. This is
2924 // passed to err_non_trivial_c_union_in_invalid_context.
2926 // Function parameter.
2928 // Function return.
2930 // Default-initialized object.
2932 // Variable with automatic storage duration.
2934 // Initializer expression that might copy from another object.
2936 // Assignment.
2938 // Compound literal.
2940 // Block capture.
2942 // lvalue-to-rvalue conversion of volatile type.
2944 };
2945
2946 /// Emit diagnostics if the initializer or any of its explicit or
2947 /// implicitly-generated subexpressions require copying or
2948 /// default-initializing a type that is or contains a C union type that is
2949 /// non-trivial to copy or default-initialize.
2951
2952 // These flags are passed to checkNonTrivialCUnion.
2958
2959 /// Emit diagnostics if a non-trivial C union type or a struct that contains
2960 /// a non-trivial C union is used in an invalid context.
2962 NonTrivialCUnionContext UseContext,
2963 unsigned NonTrivialKind);
2964
2965 void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
2966 void ActOnUninitializedDecl(Decl *dcl);
2967 void ActOnInitializerError(Decl *Dcl);
2968
2969 void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc);
2970 void ActOnCXXForRangeDecl(Decl *D);
2972 IdentifierInfo *Ident,
2973 ParsedAttributes &Attrs);
2974 void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc);
2975 void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc);
2977 void FinalizeDeclaration(Decl *D);
2979 ArrayRef<Decl *> Group);
2981
2982 /// Should be called on all declarations that might have attached
2983 /// documentation comments.
2984 void ActOnDocumentableDecl(Decl *D);
2986
2987 enum class FnBodyKind {
2988 /// C++ [dcl.fct.def.general]p1
2989 /// function-body:
2990 /// ctor-initializer[opt] compound-statement
2991 /// function-try-block
2992 Other,
2993 /// = default ;
2994 Default,
2995 /// = delete ;
2996 Delete
2997 };
2998
3000 SourceLocation LocAfterDecls);
3002 FunctionDecl *FD, const FunctionDecl *EffectiveDefinition = nullptr,
3003 SkipBodyInfo *SkipBody = nullptr);
3005 MultiTemplateParamsArg TemplateParamLists,
3006 SkipBodyInfo *SkipBody = nullptr,
3007 FnBodyKind BodyKind = FnBodyKind::Other);
3009 SkipBodyInfo *SkipBody = nullptr,
3010 FnBodyKind BodyKind = FnBodyKind::Other);
3011 void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind);
3017 return D && isa<ObjCMethodDecl>(D);
3018 }
3019
3020 /// Determine whether we can delay parsing the body of a function or
3021 /// function template until it is used, assuming we don't care about emitting
3022 /// code for that function.
3023 ///
3024 /// This will be \c false if we may need the body of the function in the
3025 /// middle of parsing an expression (where it's impractical to switch to
3026 /// parsing a different function), for instance, if it's constexpr in C++11
3027 /// or has an 'auto' return type in C++14. These cases are essentially bugs.
3028 bool canDelayFunctionBody(const Declarator &D);
3029
3030 /// Determine whether we can skip parsing the body of a function
3031 /// definition, assuming we don't care about analyzing its body or emitting
3032 /// code for that function.
3033 ///
3034 /// This will be \c false only if we may need the body of the function in
3035 /// order to parse the rest of the program (for instance, if it is
3036 /// \c constexpr in C++11 or has an 'auto' return type in C++14).
3037 bool canSkipFunctionBody(Decl *D);
3038
3041 Decl *ActOnFinishFunctionBody(Decl *Decl, Stmt *Body, bool IsInstantiation);
3044
3045 /// ActOnFinishDelayedAttribute - Invoked when we have finished parsing an
3046 /// attribute for which parsing is delayed.
3048
3049 /// Diagnose any unused parameters in the given sequence of
3050 /// ParmVarDecl pointers.
3052
3053 /// Diagnose whether the size of parameters or return value of a
3054 /// function or obj-c method definition is pass-by-value and larger than a
3055 /// specified threshold.
3056 void
3058 QualType ReturnTy, NamedDecl *D);
3059
3060 void DiagnoseInvalidJumps(Stmt *Body);
3062 SourceLocation AsmLoc,
3063 SourceLocation RParenLoc);
3064
3065 /// Handle a C++11 empty-declaration and attribute-declaration.
3067 SourceLocation SemiLoc);
3068
3069 enum class ModuleDeclKind {
3070 Interface, ///< 'export module X;'
3071 Implementation, ///< 'module X;'
3072 PartitionInterface, ///< 'export module X:Y;'
3073 PartitionImplementation, ///< 'module X:Y;'
3074 };
3075
3076 /// An enumeration to represent the transition of states in parsing module
3077 /// fragments and imports. If we are not parsing a C++20 TU, or we find
3078 /// an error in state transition, the state is set to NotACXX20Module.
3080 FirstDecl, ///< Parsing the first decl in a TU.
3081 GlobalFragment, ///< after 'module;' but before 'module X;'
3082 ImportAllowed, ///< after 'module X;' but before any non-import decl.
3083 ImportFinished, ///< after any non-import decl.
3084 PrivateFragment, ///< after 'module :private;'.
3085 NotACXX20Module ///< Not a C++20 TU, or an invalid state was found.
3086 };
3087
3088private:
3089 /// The parser has begun a translation unit to be compiled as a C++20
3090 /// Header Unit, helper for ActOnStartOfTranslationUnit() only.
3091 void HandleStartOfHeaderUnit();
3092
3093public:
3094 /// The parser has processed a module-declaration that begins the definition
3095 /// of a module interface or implementation.
3097 SourceLocation ModuleLoc, ModuleDeclKind MDK,
3098 ModuleIdPath Path, ModuleIdPath Partition,
3099 ModuleImportState &ImportState);
3100
3101 /// The parser has processed a global-module-fragment declaration that begins
3102 /// the definition of the global module fragment of the current module unit.
3103 /// \param ModuleLoc The location of the 'module' keyword.
3105
3106 /// The parser has processed a private-module-fragment declaration that begins
3107 /// the definition of the private module fragment of the current module unit.
3108 /// \param ModuleLoc The location of the 'module' keyword.
3109 /// \param PrivateLoc The location of the 'private' keyword.
3111 SourceLocation PrivateLoc);
3112
3113 /// The parser has processed a module import declaration.
3114 ///
3115 /// \param StartLoc The location of the first token in the declaration. This
3116 /// could be the location of an '@', 'export', or 'import'.
3117 /// \param ExportLoc The location of the 'export' keyword, if any.
3118 /// \param ImportLoc The location of the 'import' keyword.
3119 /// \param Path The module toplevel name as an access path.
3120 /// \param IsPartition If the name is for a partition.
3122 SourceLocation ExportLoc,
3123 SourceLocation ImportLoc, ModuleIdPath Path,
3124 bool IsPartition = false);
3126 SourceLocation ExportLoc,
3127 SourceLocation ImportLoc, Module *M,
3128 ModuleIdPath Path = {});
3129
3130 /// The parser has processed a module import translated from a
3131 /// #include or similar preprocessing directive.
3132 void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
3133 void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod);
3134
3135 /// The parsed has entered a submodule.
3136 void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod);
3137 /// The parser has left a submodule.
3138 void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod);
3139
3140 /// Create an implicit import of the given module at the given
3141 /// source location, for error recovery, if possible.
3142 ///
3143 /// This routine is typically used when an entity found by name lookup
3144 /// is actually hidden within a module that we know about but the user
3145 /// has forgotten to import.
3146 void createImplicitModuleImportForErrorRecovery(SourceLocation Loc,
3147 Module *Mod);
3148
3149 /// Kinds of missing import. Note, the values of these enumerators correspond
3150 /// to %select values in diagnostics.
3158
3159 /// Diagnose that the specified declaration needs to be visible but
3160 /// isn't, and suggest a module import that would resolve the problem.
3162 MissingImportKind MIK, bool Recover = true);
3164 SourceLocation DeclLoc, ArrayRef<Module *> Modules,
3165 MissingImportKind MIK, bool Recover);
3166
3168 SourceLocation LBraceLoc);
3170 SourceLocation RBraceLoc);
3171
3172 /// We've found a use of a templated declaration that would trigger an
3173 /// implicit instantiation. Check that any relevant explicit specializations
3174 /// and partial specializations are visible/reachable, and diagnose if not.
3177
3178 /// Retrieve a suitable printing policy for diagnostics.
3182
3183 /// Retrieve a suitable printing policy for diagnostics.
3185 const Preprocessor &PP);
3186
3187 /// Scope actions.
3188 void ActOnPopScope(SourceLocation Loc, Scope *S);
3190
3192 const ParsedAttributesView &DeclAttrs,
3193 RecordDecl *&AnonRecord);
3195 const ParsedAttributesView &DeclAttrs,
3196 MultiTemplateParamsArg TemplateParams,
3197 bool IsExplicitInstantiation,
3198 RecordDecl *&AnonRecord);
3199
3201 AccessSpecifier AS,
3202 RecordDecl *Record,
3203 const PrintingPolicy &Policy);
3204
3206 RecordDecl *Record);
3207
3208 /// Common ways to introduce type names without a tag for use in diagnostics.
3209 /// Keep in sync with err_tag_reference_non_tag.
3221
3222 /// Given a non-tag type declaration, returns an enum useful for indicating
3223 /// what kind of non-tag type this is.
3225
3227 TagTypeKind NewTag, bool isDefinition,
3228 SourceLocation NewTagLoc,
3229 const IdentifierInfo *Name);
3230
3232 TUK_Reference, // Reference to a tag: 'struct foo *X;'
3233 TUK_Declaration, // Fwd decl of a tag: 'struct foo;'
3234 TUK_Definition, // Definition of a tag: 'struct foo { int X; } Y;'
3235 TUK_Friend // Friend declaration: 'friend struct foo;'
3237
3238 Decl *ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
3239 SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name,
3241 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
3242 MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl,
3243 bool &IsDependent, SourceLocation ScopedEnumKWLoc,
3244 bool ScopedEnumUsesClassTag, TypeResult UnderlyingType,
3245 bool IsTypeSpecifier, bool IsTemplateParamOrArg,
3246 SkipBodyInfo *SkipBody = nullptr);
3247
3249 unsigned TagSpec, SourceLocation TagLoc,
3250 CXXScopeSpec &SS, IdentifierInfo *Name,
3251 SourceLocation NameLoc,
3253 MultiTemplateParamsArg TempParamLists);
3254
3256 unsigned TagSpec,
3257 TagUseKind TUK,
3258 const CXXScopeSpec &SS,
3259 IdentifierInfo *Name,
3260 SourceLocation TagLoc,
3261 SourceLocation NameLoc);
3262
3263 void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart,
3264 IdentifierInfo *ClassName,
3266 Decl *ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart,
3267 Declarator &D, Expr *BitfieldWidth);
3268
3269 FieldDecl *HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart,
3270 Declarator &D, Expr *BitfieldWidth,
3271 InClassInitStyle InitStyle,
3272 AccessSpecifier AS);
3274 SourceLocation DeclStart, Declarator &D,
3275 Expr *BitfieldWidth,
3276 InClassInitStyle InitStyle,
3277 AccessSpecifier AS,
3278 const ParsedAttr &MSPropertyAttr);
3279
3281 TypeSourceInfo *TInfo,
3282 RecordDecl *Record, SourceLocation Loc,
3283 bool Mutable, Expr *BitfieldWidth,
3284 InClassInitStyle InitStyle,
3285 SourceLocation TSSL,
3286 AccessSpecifier AS, NamedDecl *PrevDecl,
3287 Declarator *D = nullptr);
3288
3290 void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM);
3291
3293 /// The triviality of a method unaffected by "trivial_abi".
3295
3296 /// The triviality of a method affected by "trivial_abi".
3299
3300 bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM,
3302 bool Diagnose = false);
3303
3304 /// For a defaulted function, the kind of defaulted function that it is.
3306 CXXSpecialMember SpecialMember : 8;
3307 DefaultedComparisonKind Comparison : 8;
3308
3309 public:
3311 : SpecialMember(CXXInvalid), Comparison(DefaultedComparisonKind::None) {
3312 }
3314 : SpecialMember(CSM), Comparison(DefaultedComparisonKind::None) {}
3316 : SpecialMember(CXXInvalid), Comparison(Comp) {}
3317
3318 bool isSpecialMember() const { return SpecialMember != CXXInvalid; }
3319 bool isComparison() const {
3320 return Comparison != DefaultedComparisonKind::None;
3321 }
3322
3323 explicit operator bool() const {
3324 return isSpecialMember() || isComparison();
3325 }
3326
3327 CXXSpecialMember asSpecialMember() const { return SpecialMember; }
3328 DefaultedComparisonKind asComparison() const { return Comparison; }
3329
3330 /// Get the index of this function kind for use in diagnostics.
3331 unsigned getDiagnosticIndex() const {
3332 static_assert(CXXInvalid > CXXDestructor,
3333 "invalid should have highest index");
3334 static_assert((unsigned)DefaultedComparisonKind::None == 0,
3335 "none should be equal to zero");
3336 return SpecialMember + (unsigned)Comparison;
3337 }
3338 };
3339
3340 DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD);
3341
3348
3349 void ActOnLastBitfield(SourceLocation DeclStart,
3350 SmallVectorImpl<Decl *> &AllIvarDecls);
3351 Decl *ActOnIvar(Scope *S, SourceLocation DeclStart,
3352 Declarator &D, Expr *BitfieldWidth,
3353 tok::ObjCKeywordKind visibility);
3354
3355 // This is used for both record definitions and ObjC interface declarations.
3356 void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl,
3357 ArrayRef<Decl *> Fields, SourceLocation LBrac,
3358 SourceLocation RBrac, const ParsedAttributesView &AttrList);
3359
3360 /// ActOnTagStartDefinition - Invoked when we have entered the
3361 /// scope of a tag's definition (e.g., for an enumeration, class,
3362 /// struct, or union).
3364
3365 /// Perform ODR-like check for C/ObjC when merging tag types from modules.
3366 /// Differently from C++, actually parse the body and reject / error out
3367 /// in case of a structural mismatch.
3368 bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody);
3369
3371
3372 /// Invoked when we enter a tag definition that we're skipping.
3374
3376
3377 /// ActOnStartCXXMemberDeclarations - Invoked when we have parsed a
3378 /// C++ record definition's base-specifiers clause and are starting its
3379 /// member declarations.
3381 SourceLocation FinalLoc,
3382 bool IsFinalSpelledSealed,
3383 bool IsAbstract,
3384 SourceLocation LBraceLoc);
3385
3386 /// ActOnTagFinishDefinition - Invoked once we have finished parsing
3387 /// the definition of a tag (enumeration, class, struct, or union).
3389 SourceRange BraceRange);
3390
3392
3394
3395 /// Invoked when we must temporarily exit the objective-c container
3396 /// scope for parsing/looking-up C constructs.
3397 ///
3398 /// Must be followed by a call to \see ActOnObjCReenterContainerContext
3401
3402 /// ActOnTagDefinitionError - Invoked when there was an unrecoverable
3403 /// error parsing the definition of a tag.
3405
3407 EnumConstantDecl *LastEnumConst,
3408 SourceLocation IdLoc,
3410 Expr *val);
3412 bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped,
3413 QualType EnumUnderlyingTy, bool IsFixed,
3414 const EnumDecl *Prev);
3415
3416 /// Determine whether the body of an anonymous enumeration should be skipped.
3417 /// \param II The name of the first enumerator.
3419 SourceLocation IILoc);
3420
3421 Decl *ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant,
3423 const ParsedAttributesView &Attrs,
3424 SourceLocation EqualLoc, Expr *Val);
3425 void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange,
3426 Decl *EnumDecl, ArrayRef<Decl *> Elements, Scope *S,
3427 const ParsedAttributesView &Attr);
3428
3429 /// Set the current declaration context until it gets popped.
3430 void PushDeclContext(Scope *S, DeclContext *DC);
3431 void PopDeclContext();
3432
3433 /// EnterDeclaratorContext - Used when we must lookup names in the context
3434 /// of a declarator's nested name specifier.
3437
3438 /// Enter a template parameter scope, after it's been associated with a particular
3439 /// DeclContext. Causes lookup within the scope to chain through enclosing contexts
3440 /// in the correct order.
3442
3443 /// Push the parameters of D, which must be a function, into scope.
3446
3447 /// If \p AllowLambda is true, treat lambda as function.
3448 DeclContext *getFunctionLevelDeclContext(bool AllowLambda = false);
3449
3450 /// Returns a pointer to the innermost enclosing function, or nullptr if the
3451 /// current context is not inside a function. If \p AllowLambda is true,
3452 /// this can return the call operator of an enclosing lambda, otherwise
3453 /// lambdas are skipped when looking for an enclosing function.
3454 FunctionDecl *getCurFunctionDecl(bool AllowLambda = false);
3455
3456 /// getCurMethodDecl - If inside of a method body, this returns a pointer to
3457 /// the method decl for the method being parsed. If we're currently
3458 /// in a 'block', this returns the containing context.
3460
3461 /// getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method
3462 /// or C function we're in, otherwise return null. If we're currently
3463 /// in a 'block', this returns the containing context.
3465
3466 /// Add this decl to the scope shadowed decl chains.
3467 void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext = true);
3468
3469 /// isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true
3470 /// if 'D' is in Scope 'S', otherwise 'S' is ignored and isDeclInScope returns
3471 /// true if 'D' belongs to the given declaration context.
3472 ///
3473 /// \param AllowInlineNamespace If \c true, allow the declaration to be in the
3474 /// enclosing namespace set of the context, rather than contained
3475 /// directly within it.
3476 bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S = nullptr,
3477 bool AllowInlineNamespace = false);
3478
3479 /// Finds the scope corresponding to the given decl context, if it
3480 /// happens to be an enclosing scope. Otherwise return NULL.
3482
3483 /// Subroutines of ActOnDeclarator().
3485 TypeSourceInfo *TInfo);
3487
3488 /// Describes the kind of merge to perform for availability
3489 /// attributes (including "deprecated", "unavailable", and "availability").
3491 /// Don't merge availability attributes at all.
3493 /// Merge availability attributes for a redeclaration, which requires
3494 /// an exact match.
3496 /// Merge availability attributes for an override, which requires
3497 /// an exact match or a weakening of constraints.
3499 /// Merge availability attributes for an implementation of
3500 /// a protocol requirement.
3502 /// Merge availability attributes for an implementation of
3503 /// an optional protocol requirement.
3506
3507 /// Describes the kind of priority given to an availability attribute.
3508 ///
3509 /// The sum of priorities deteremines the final priority of the attribute.
3510 /// The final priority determines how the attribute will be merged.
3511 /// An attribute with a lower priority will always remove higher priority
3512 /// attributes for the specified platform when it is being applied. An
3513 /// attribute with a higher priority will not be applied if the declaration
3514 /// already has an availability attribute with a lower priority for the
3515 /// specified platform. The final prirority values are not expected to match
3516 /// the values in this enumeration, but instead should be treated as a plain
3517 /// integer value. This enumeration just names the priority weights that are
3518 /// used to calculate that final vaue.
3520 /// The availability attribute was specified explicitly next to the
3521 /// declaration.
3523
3524 /// The availability attribute was applied using '#pragma clang attribute'.
3526
3527 /// The availability attribute for a specific platform was inferred from
3528 /// an availability attribute for another platform.
3531
3532 /// Attribute merging methods. Return true if a new attribute was added.
3533 AvailabilityAttr *
3535 IdentifierInfo *Platform, bool Implicit,
3536 VersionTuple Introduced, VersionTuple Deprecated,
3537 VersionTuple Obsoleted, bool IsUnavailable,
3538 StringRef Message, bool IsStrict, StringRef Replacement,
3539 AvailabilityMergeKind AMK, int Priority);
3540 TypeVisibilityAttr *
3542 TypeVisibilityAttr::VisibilityType Vis);
3543 VisibilityAttr *mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI,
3544 VisibilityAttr::VisibilityType Vis);
3545 UuidAttr *mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI,
3546 StringRef UuidAsWritten, MSGuidDecl *GuidDecl);
3547 DLLImportAttr *mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI);
3548 DLLExportAttr *mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI);
3549 MSInheritanceAttr *mergeMSInheritanceAttr(Decl *D,
3550 const AttributeCommonInfo &CI,
3551 bool BestCase,
3552 MSInheritanceModel Model);
3553 ErrorAttr *mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI,
3554 StringRef NewUserDiagnostic);
3555 FormatAttr *mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI,
3556 IdentifierInfo *Format, int FormatIdx,
3557 int FirstArg);
3558 SectionAttr *mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI,
3559 StringRef Name);
3560 CodeSegAttr *mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI,
3561 StringRef Name);
3562 AlwaysInlineAttr *mergeAlwaysInlineAttr(Decl *D,
3563 const AttributeCommonInfo &CI,
3564 const IdentifierInfo *Ident);
3565 MinSizeAttr *mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI);
3566 SwiftNameAttr *mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA,
3567 StringRef Name);
3568 OptimizeNoneAttr *mergeOptimizeNoneAttr(Decl *D,
3569 const AttributeCommonInfo &CI);
3570 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL);
3571 InternalLinkageAttr *mergeInternalLinkageAttr(Decl *D,
3572 const InternalLinkageAttr &AL);
3573 WebAssemblyImportNameAttr *mergeImportNameAttr(
3574 Decl *D, const WebAssemblyImportNameAttr &AL);
3575 WebAssemblyImportModuleAttr *mergeImportModuleAttr(
3576 Decl *D, const WebAssemblyImportModuleAttr &AL);
3577 EnforceTCBAttr *mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL);
3578 EnforceTCBLeafAttr *mergeEnforceTCBLeafAttr(Decl *D,
3579 const EnforceTCBLeafAttr &AL);
3580 BTFDeclTagAttr *mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL);
3581 HLSLNumThreadsAttr *mergeHLSLNumThreadsAttr(Decl *D,
3582 const AttributeCommonInfo &AL,
3583 int X, int Y, int Z);
3584 HLSLShaderAttr *mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL,
3585 HLSLShaderAttr::ShaderType ShaderType);
3586
3587 void mergeDeclAttributes(NamedDecl *New, Decl *Old,
3590 LookupResult &OldDecls);
3591 bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S,
3592 bool MergeTypeWithOld, bool NewDeclIsDefn);
3594 Scope *S, bool MergeTypeWithOld);
3597 void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld);
3599 bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn);
3600 void notePreviousDefinition(const NamedDecl *Old, SourceLocation New);
3602
3603 // AssignmentAction - This is used by all the assignment diagnostic functions
3604 // to represent what is actually causing the operation
3615
3616 /// C++ Overloading.
3618 /// This is a legitimate overload: the existing declarations are
3619 /// functions or function templates with different signatures.
3621
3622 /// This is not an overload because the signature exactly matches
3623 /// an existing declaration.
3625
3626 /// This is not an overload because the lookup results contain a
3627 /// non-function.
3631 FunctionDecl *New,
3632 const LookupResult &OldDecls,
3633 NamedDecl *&OldDecl,
3634 bool IsForUsingDecl);
3635 bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl,
3636 bool ConsiderCudaAttrs = true,
3637 bool ConsiderRequiresClauses = true);
3638
3639 enum class AllowedExplicit {
3640 /// Allow no explicit functions to be used.
3641 None,
3642 /// Allow explicit conversion functions but not explicit constructors.
3644 /// Allow both explicit conversion functions and explicit constructors.
3645 All
3646 };
3647
3649 TryImplicitConversion(Expr *From, QualType ToType,
3650 bool SuppressUserConversions,
3651 AllowedExplicit AllowExplicit,
3652 bool InOverloadResolution,
3653 bool CStyle,
3654 bool AllowObjCWritebackConversion);
3655
3656 bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
3657 bool IsFloatingPointPromotion(QualType FromType, QualType ToType);
3658 bool IsComplexPromotion(QualType FromType, QualType ToType);
3659 bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType,
3660 bool InOverloadResolution,
3661 QualType& ConvertedType, bool &IncompatibleObjC);
3662 bool isObjCPointerConversion(QualType FromType, QualType ToType,
3663 QualType& ConvertedType, bool &IncompatibleObjC);
3664 bool isObjCWritebackConversion(QualType FromType, QualType ToType,
3665 QualType &ConvertedType);
3666 bool IsBlockPointerConversion(QualType FromType, QualType ToType,
3667 QualType& ConvertedType);
3669 const FunctionProtoType *NewType,
3670 unsigned *ArgPos = nullptr,
3671 bool Reversed = false);
3673 QualType FromType, QualType ToType);
3674
3677 bool CheckPointerConversion(Expr *From, QualType ToType,
3678 CastKind &Kind,
3679 CXXCastPath& BasePath,
3680 bool IgnoreBaseAccess,
3681 bool Diagnose = true);
3682 bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType,
3683 bool InOverloadResolution,
3684 QualType &ConvertedType);
3685 bool CheckMemberPointerConversion(Expr *From, QualType ToType,
3686 CastKind &Kind,
3687 CXXCastPath &BasePath,
3688 bool IgnoreBaseAccess);
3689 bool IsQualificationConversion(QualType FromType, QualType ToType,
3690 bool CStyle, bool &ObjCLifetimeConversion);
3691 bool IsFunctionConversion(QualType FromType, QualType ToType,
3692 QualType &ResultTy);
3695
3697 const InitializedEntity &Entity, InitListExpr *From);
3698
3699 bool IsStringInit(Expr *Init, const ArrayType *AT);
3700
3702 ExprResult Init);
3704 SourceLocation EqualLoc,
3705 ExprResult Init,
3706 bool TopLevelOfInitList = false,
3707 bool AllowExplicit = false);
3709 NestedNameSpecifier *Qualifier,
3710 NamedDecl *FoundDecl,
3711 CXXMethodDecl *Method);
3712
3713 /// Check that the lifetime of the initializer (and its subobjects) is
3714 /// sufficient for initializing the entity, and perform lifetime extension
3715 /// (when permitted) if not.
3716 void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init);
3717
3720
3721 /// Contexts in which a converted constant expression is required.
3722 enum CCEKind {
3723 CCEK_CaseValue, ///< Expression in a case label.
3724 CCEK_Enumerator, ///< Enumerator value with fixed underlying type.
3725 CCEK_TemplateArg, ///< Value of a non-type template parameter.
3726 CCEK_ArrayBound, ///< Array bound in array declarator or new-expression.
3727 CCEK_ExplicitBool, ///< Condition in an explicit(bool) specifier.
3728 CCEK_Noexcept ///< Condition in a noexcept(bool) specifier.
3731 llvm::APSInt &Value, CCEKind CCE);
3733 APValue &Value, CCEKind CCE,
3734 NamedDecl *Dest = nullptr);
3735
3736 /// Abstract base class used to perform a contextual implicit
3737 /// conversion from an expression to any type passing a filter.
3739 public:
3742
3746
3747 /// Determine whether the specified type is a valid destination type
3748 /// for this conversion.
3749 virtual bool match(QualType T) = 0;
3750
3751 /// Emits a diagnostic complaining that the expression does not have
3752 /// integral or enumeration type.
3753 virtual SemaDiagnosticBuilder
3755
3756 /// Emits a diagnostic when the expression has incomplete class type.
3757 virtual SemaDiagnosticBuilder
3759
3760 /// Emits a diagnostic when the only matching conversion function
3761 /// is explicit.
3763 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3764
3765 /// Emits a note for the explicit conversion function.
3766 virtual SemaDiagnosticBuilder
3768
3769 /// Emits a diagnostic when there are multiple possible conversion
3770 /// functions.
3771 virtual SemaDiagnosticBuilder
3773
3774 /// Emits a note for one of the candidate conversions.
3775 virtual SemaDiagnosticBuilder
3777
3778 /// Emits a diagnostic when we picked a conversion function
3779 /// (for cases when we are not allowed to pick a conversion function).
3781 Sema &S, SourceLocation Loc, QualType T, QualType ConvTy) = 0;
3782
3784 };
3785
3787 bool AllowScopedEnumerations;
3788
3789 public:
3790 ICEConvertDiagnoser(bool AllowScopedEnumerations,
3791 bool Suppress, bool SuppressConversion)
3793 AllowScopedEnumerations(AllowScopedEnumerations) {}
3794
3795 /// Match an integral or (possibly scoped) enumeration type.
3796 bool match(QualType T) override;
3797
3800 return diagnoseNotInt(S, Loc, T);
3801 }
3802
3803 /// Emits a diagnostic complaining that the expression does not have
3804 /// integral or enumeration type.
3805 virtual SemaDiagnosticBuilder
3807 };
3808
3809 /// Perform a contextual implicit conversion.
3811 SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter);
3812
3813
3820
3821 // Note that LK_String is intentionally after the other literals, as
3822 // this is used for diagnostics logic.
3833
3835 NestedNameSpecifier *Qualifier,
3836 NamedDecl *FoundDecl,
3837 NamedDecl *Member);
3838
3839 // Members have to be NamespaceDecl* or TranslationUnitDecl*.
3840 // TODO: make this is a typesafe union.
3843
3845
3846 void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl,
3847 ArrayRef<Expr *> Args,
3848 OverloadCandidateSet &CandidateSet,
3849 bool SuppressUserConversions = false,
3850 bool PartialOverloading = false,
3851 bool AllowExplicit = true,
3852 bool AllowExplicitConversion = false,
3853 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
3854 ConversionSequenceList EarlyConversions = None,
3856 void AddFunctionCandidates(const UnresolvedSetImpl &Functions,
3857 ArrayRef<Expr *> Args,
3858 OverloadCandidateSet &CandidateSet,
3859 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
3860 bool SuppressUserConversions = false,
3861 bool PartialOverloading = false,
3862 bool FirstArgumentIsBase = false);
3863 void AddMethodCandidate(DeclAccessPair FoundDecl,
3864 QualType ObjectType,
3865 Expr::Classification ObjectClassification,
3866 ArrayRef<Expr *> Args,
3867 OverloadCandidateSet& CandidateSet,
3868 bool SuppressUserConversion = false,
3870 void AddMethodCandidate(CXXMethodDecl *Method,
3871 DeclAccessPair FoundDecl,
3872 CXXRecordDecl *ActingContext, QualType ObjectType,
3873 Expr::Classification ObjectClassification,
3874 ArrayRef<Expr *> Args,
3875 OverloadCandidateSet& CandidateSet,
3876 bool SuppressUserConversions = false,
3877 bool PartialOverloading = false,
3878 ConversionSequenceList EarlyConversions = None,
3880 void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl,
3881 DeclAccessPair FoundDecl,
3882 CXXRecordDecl *ActingContext,
3883 TemplateArgumentListInfo *ExplicitTemplateArgs,
3884 QualType ObjectType,
3885 Expr::Classification ObjectClassification,
3886 ArrayRef<Expr *> Args,
3887 OverloadCandidateSet& CandidateSet,
3888 bool SuppressUserConversions = false,
3889 bool PartialOverloading = false,
3892 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
3893 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
3894 OverloadCandidateSet &CandidateSet, bool SuppressUserConversions = false,
3895 bool PartialOverloading = false, bool AllowExplicit = true,
3896 ADLCallKind IsADLCandidate = ADLCallKind::NotADL,
3899 FunctionTemplateDecl *FunctionTemplate, ArrayRef<QualType> ParamTypes,
3900 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet,
3901 ConversionSequenceList &Conversions, bool SuppressUserConversions,
3902 CXXRecordDecl *ActingContext = nullptr, QualType ObjectType = QualType(),
3903 Expr::Classification ObjectClassification = {},
3906 CXXConversionDecl *Conversion, DeclAccessPair FoundDecl,
3907 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
3908 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
3909 bool AllowExplicit, bool AllowResultConversion = true);
3911 FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
3912 CXXRecordDecl *ActingContext, Expr *From, QualType ToType,
3913 OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit,
3914 bool AllowExplicit, bool AllowResultConversion = true);
3915 void AddSurrogateCandidate(CXXConversionDecl *Conversion,
3916 DeclAccessPair FoundDecl,
3917 CXXRecordDecl *ActingContext,
3918 const FunctionProtoType *Proto,
3919 Expr *Object, ArrayRef<Expr *> Args,
3920 OverloadCandidateSet& CandidateSet);
3922 const UnresolvedSetImpl &Functions, ArrayRef<Expr *> Args,
3923 OverloadCandidateSet &CandidateSet,
3924 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
3925 void AddMemberOperatorCandidates(OverloadedOperatorKind Op,
3926 SourceLocation OpLoc, ArrayRef<Expr *> Args,
3927 OverloadCandidateSet &CandidateSet,
3929 void AddBuiltinCandidate(QualType *ParamTys, ArrayRef<Expr *> Args,
3930 OverloadCandidateSet& CandidateSet,
3931 bool IsAssignmentOperator = false,
3932 unsigned NumContextualBoolArguments = 0);
3933 void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op,
3934 SourceLocation OpLoc, ArrayRef<Expr *> Args,
3935 OverloadCandidateSet& CandidateSet);
3936 void AddArgumentDependentLookupCandidates(DeclarationName Name,
3937 SourceLocation Loc,
3938 ArrayRef<Expr *> Args,
3939 TemplateArgumentListInfo *ExplicitTemplateArgs,
3940 OverloadCandidateSet& CandidateSet,
3941 bool PartialOverloading = false);
3942
3943 // Emit as a 'note' the specific overload candidate
3945 NamedDecl *Found, FunctionDecl *Fn,
3947 QualType DestType = QualType(), bool TakingAddress = false);
3948
3949 // Emit as a series of 'note's all template and non-templates identified by
3950 // the expression Expr
3951 void NoteAllOverloadCandidates(Expr *E, QualType DestType = QualType(),
3952 bool TakingAddress = false);
3953
3954 /// Check the enable_if expressions on the given function. Returns the first
3955 /// failing attribute, or NULL if they were all successful.
3956 EnableIfAttr *CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc,
3957 ArrayRef<Expr *> Args,
3958 bool MissingImplicitThis = false);
3959
3960 /// Find the failed Boolean condition within a given Boolean
3961 /// constant expression, and describe it with a string.
3962 std::pair<Expr *, std::string> findFailedBooleanCondition(Expr *Cond);
3963
3964 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
3965 /// non-ArgDependent DiagnoseIfAttrs.
3966 ///
3967 /// Argument-dependent diagnose_if attributes should be checked each time a
3968 /// function is used as a direct callee of a function call.
3969 ///
3970 /// Returns true if any errors were emitted.
3971 bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function,
3972 const Expr *ThisArg,
3973 ArrayRef<const Expr *> Args,
3974 SourceLocation Loc);
3975
3976 /// Emit diagnostics for the diagnose_if attributes on Function, ignoring any
3977 /// ArgDependent DiagnoseIfAttrs.
3978 ///
3979 /// Argument-independent diagnose_if attributes should be checked on every use
3980 /// of a function.
3981 ///
3982 /// Returns true if any errors were emitted.
3983 bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND,
3984 SourceLocation Loc);
3985
3986 /// Returns whether the given function's address can be taken or not,
3987 /// optionally emitting a diagnostic if the address can't be taken.
3988 ///
3989 /// Returns false if taking the address of the function is illegal.
3990 bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function,
3991 bool Complain = false,
3992 SourceLocation Loc = SourceLocation());
3993
3994 // [PossiblyAFunctionType] --> [Return]
3995 // NonFunctionType --> NonFunctionType
3996 // R (A) --> R(A)
3997 // R (*)(A) --> R (A)
3998 // R (&)(A) --> R (A)
3999 // R (S::*)(A) --> R (A)
4000 QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType);
4001
4002 FunctionDecl *
4003 ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr,
4004 QualType TargetType,
4005 bool Complain,
4006 DeclAccessPair &Found,
4007 bool *pHadMultipleCandidates = nullptr);
4008
4009 FunctionDecl *
4010 resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult);
4011
4013 ExprResult &SrcExpr, bool DoFunctionPointerConversion = false);
4014
4015 FunctionDecl *
4017 bool Complain = false,
4018 DeclAccessPair *Found = nullptr);
4019
4021 ExprResult &SrcExpr,
4022 bool DoFunctionPointerConverion = false,
4023 bool Complain = false,
4024 SourceRange OpRangeForComplaining = SourceRange(),
4025 QualType DestTypeForComplaining = QualType(),
4026 unsigned DiagIDForComplaining = 0);
4027
4028
4029 Expr *FixOverloadedFunctionReference(Expr *E,
4030 DeclAccessPair FoundDecl,
4031 FunctionDecl *Fn);
4033 DeclAccessPair FoundDecl,
4034 FunctionDecl *Fn);
4035
4036 void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE,
4037 ArrayRef<Expr *> Args,
4038 OverloadCandidateSet &CandidateSet,
4039 bool PartialOverloading = false);
4041 LookupResult &R, TemplateArgumentListInfo *ExplicitTemplateArgs,
4042 ArrayRef<Expr *> Args, OverloadCandidateSet &CandidateSet);
4043
4044 // An enum used to represent the different possible results of building a
4045 // range-based for loop.
4051
4053 SourceLocation RangeLoc,
4054 const DeclarationNameInfo &NameInfo,
4055 LookupResult &MemberLookup,
4056 OverloadCandidateSet *CandidateSet,
4057 Expr *Range, ExprResult *CallExpr);
4058
4061 SourceLocation LParenLoc,
4062 MultiExprArg Args,
4063 SourceLocation RParenLoc,
4064 Expr *ExecConfig,
4065 bool AllowTypoCorrection=true,
4066 bool CalleesAddressIsTaken=false);
4067
4069 MultiExprArg Args, SourceLocation RParenLoc,
4070 OverloadCandidateSet *CandidateSet,
4072
4076 const UnresolvedSetImpl &Fns,
4077 bool PerformADL = true);
4078
4081 const UnresolvedSetImpl &Fns,
4082 Expr *input, bool RequiresADL = true);
4083
4086 const UnresolvedSetImpl &Fns,
4087 ArrayRef<Expr *> Args, bool RequiresADL = true);
4090 const UnresolvedSetImpl &Fns,
4091 Expr *LHS, Expr *RHS,
4092 bool RequiresADL = true,
4093 bool AllowRewrittenCandidates = true,
4094 FunctionDecl *DefaultedFn = nullptr);
4096 const UnresolvedSetImpl &Fns,
4097 Expr *LHS, Expr *RHS,
4098 FunctionDecl *DefaultedFn);
4099
4101 SourceLocation RLoc, Expr *Base,
4102 MultiExprArg Args);
4103
4105 SourceLocation LParenLoc,
4106 MultiExprArg Args,
4107 SourceLocation RParenLoc,
4108 Expr *ExecConfig = nullptr,
4109 bool IsExecConfig = false,
4110 bool AllowRecovery = false);
4113 MultiExprArg Args,
4114 SourceLocation RParenLoc);
4115
4117 SourceLocation OpLoc,
4118 bool *NoArrowOperatorFound = nullptr);
4119
4120 /// CheckCallReturnType - Checks that a call expression's return type is
4121 /// complete. Returns true on failure. The location passed in is the location
4122 /// that best represents the call.
4123 bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc,
4124 CallExpr *CE, FunctionDecl *FD);
4125
4126 /// Helpers for dealing with blocks and functions.
4128 bool CheckParameterNames);
4132
4133 /// \name Name lookup
4134 ///
4135 /// These routines provide name lookup that is used during semantic
4136 /// analysis to resolve the various kinds of names (identifiers,
4137 /// overloaded operator names, constructor names, etc.) into zero or
4138 /// more declarations within a particular scope. The major entry
4139 /// points are LookupName, which performs unqualified name lookup,
4140 /// and LookupQualifiedName, which performs qualified name lookup.
4141 ///
4142 /// All name lookup is performed based on some specific criteria,
4143 /// which specify what names will be visible to name lookup and how
4144 /// far name lookup should work. These criteria are important both
4145 /// for capturing language semantics (certain lookups will ignore
4146 /// certain names, for example) and for performance, since name
4147 /// lookup is often a bottleneck in the compilation of C++. Name
4148 /// lookup criteria is specified via the LookupCriteria enumeration.
4149 ///
4150 /// The results of name lookup can vary based on the kind of name
4151 /// lookup performed, the current language, and the translation
4152 /// unit. In C, for example, name lookup will either return nothing
4153 /// (no entity found) or a single declaration. In C++, name lookup
4154 /// can additionally refer to a set of overloaded functions or
4155 /// result in an ambiguity. All of the possible results of name
4156 /// lookup are captured by the LookupResult class, which provides
4157 /// the ability to distinguish among them.
4158 //@{
4159
4160 /// Describes the kind of name lookup to perform.
4162 /// Ordinary name lookup, which finds ordinary names (functions,
4163 /// variables, typedefs, etc.) in C and most kinds of names
4164 /// (functions, variables, members, types, etc.) in C++.
4166 /// Tag name lookup, which finds the names of enums, classes,
4167 /// structs, and unions.
4169 /// Label name lookup.
4171 /// Member name lookup, which finds the names of
4172 /// class/struct/union members.
4174 /// Look up of an operator name (e.g., operator+) for use with
4175 /// operator overloading. This lookup is similar to ordinary name
4176 /// lookup, but will ignore any declarations that are class members.
4178 /// Look up a name following ~ in a destructor name. This is an ordinary
4179 /// lookup, but prefers tags to typedefs.
4181 /// Look up of a name that precedes the '::' scope resolution
4182 /// operator in C++. This lookup completely ignores operator, object,
4183 /// function, and enumerator names (C++ [basic.lookup.qual]p1).
4185 /// Look up a namespace name within a C++ using directive or
4186 /// namespace alias definition, ignoring non-namespace names (C++
4187 /// [basic.lookup.udir]p1).
4189 /// Look up all declarations in a scope with the given name,
4190 /// including resolved using declarations. This is appropriate
4191 /// for checking redeclarations for a using declaration.
4193 /// Look up an ordinary name that is going to be redeclared as a
4194 /// name with linkage. This lookup ignores any declarations that
4195 /// are outside of the current scope unless they have linkage. See
4196 /// C99 6.2.2p4-5 and C++ [basic.link]p6.
4198 /// Look up a friend of a local class. This lookup does not look
4199 /// outside the innermost non-class scope. See C++11 [class.friend]p11.
4201 /// Look up the name of an Objective-C protocol.
4203 /// Look up implicit 'self' parameter of an objective-c method.
4205 /// Look up the name of an OpenMP user-defined reduction operation.
4207 /// Look up the name of an OpenMP user-defined mapper.
4209 /// Look up any declaration with any name.
4212
4213 /// Specifies whether (or how) name lookup is being performed for a
4214 /// redeclaration (vs. a reference).
4216 /// The lookup is a reference to this name that is not for the
4217 /// purpose of redeclaring the name.
4219 /// The lookup results will be used for redeclaration of a name,
4220 /// if an entity by that name already exists and is visible.
4222 /// The lookup results will be used for redeclaration of a name
4223 /// with external linkage; non-visible lookup results with external linkage
4224 /// may also be found.
4227
4229 // A declaration with an owning module for linkage can never link against
4230 // anything that is not visible. We don't need to check linkage here; if
4231 // the context has internal linkage, redeclaration lookup won't find things
4232 // from other TUs, and we can't safely compute linkage yet in general.
4233 if (cast<Decl>(CurContext)
4234 ->getOwningModuleForLinkage(/*IgnoreLinkage*/true))
4237 }
4238
4239 /// The possible outcomes of name lookup for a literal operator.
4241 /// The lookup resulted in an error.
4243 /// The lookup found no match but no diagnostic was issued.
4245 /// The lookup found a single 'cooked' literal operator, which
4246 /// expects a normal literal to be built and passed to it.
4248 /// The lookup found a single 'raw' literal operator, which expects
4249 /// a string literal containing the spelling of the literal token.
4251 /// The lookup found an overload set of literal operator templates,
4252 /// which expect the characters of the spelling of the literal token to be
4253 /// passed as a non-type template argument pack.
4255 /// The lookup found an overload set of literal operator templates,
4256 /// which expect the character type and characters of the spelling of the
4257 /// string literal token to be passed as template arguments.
4259 };
4260
4261 SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D,
4262 CXXSpecialMember SM,
4263 bool ConstArg,
4264 bool VolatileArg,
4265 bool RValueThis,
4266 bool ConstThis,
4267 bool VolatileThis);
4268
4269 typedef std::function<void(const TypoCorrection &)> TypoDiagnosticGenerator;
4270 typedef std::function<ExprResult(Sema &, TypoExpr *, TypoCorrection)>
4272
4273private:
4274 bool CppLookupName(LookupResult &R, Scope *S);
4275
4276 struct TypoExprState {
4277 std::unique_ptr<TypoCorrectionConsumer> Consumer;
4278 TypoDiagnosticGenerator DiagHandler;
4279 TypoRecoveryCallback RecoveryHandler;
4280 TypoExprState();
4281 TypoExprState(TypoExprState &&other) noexcept;
4282 TypoExprState &operator=(TypoExprState &&other) noexcept;
4283 };
4284
4285 /// The set of unhandled TypoExprs and their associated state.
4286 llvm::MapVector<TypoExpr *, TypoExprState> DelayedTypos;
4287
4288 /// Creates a new TypoExpr AST node.
4289 TypoExpr *createDelayedTypo(std::unique_ptr<TypoCorrectionConsumer> TCC,
4292
4293 // The set of known/encountered (unique, canonicalized) NamespaceDecls.
4294 //
4295 // The boolean value will be true to indicate that the namespace was loaded
4296 // from an AST/PCH file, or false otherwise.
4297 llvm::MapVector<NamespaceDecl*, bool> KnownNamespaces;
4298
4299 /// Whether we have already loaded known namespaces from an extenal
4300 /// source.
4301 bool LoadedExternalKnownNamespaces;
4302
4303 /// Helper for CorrectTypo and CorrectTypoDelayed used to create and
4304 /// populate a new TypoCorrectionConsumer. Returns nullptr if typo correction
4305 /// should be skipped entirely.
4306 std::unique_ptr<TypoCorrectionConsumer>
4307 makeTypoCorrectionConsumer(const DeclarationNameInfo &Typo,
4308 Sema::LookupNameKind LookupKind, Scope *S,
4309 CXXScopeSpec *SS,
4311 DeclContext *MemberContext, bool EnteringContext,
4312 const ObjCObjectPointerType *OPT,
4313 bool ErrorRecovery);
4314
4315public:
4316 const TypoExprState &getTypoExprState(TypoExpr *TE) const;
4317
4318 /// Clears the state of the given TypoExpr.
4319 void clearDelayedTypo(TypoExpr *TE);
4320
4321 /// Look up a name, looking for a single declaration. Return
4322 /// null if the results were absent, ambiguous, or overloaded.
4323 ///
4324 /// It is preferable to use the elaborated form and explicitly handle
4325 /// ambiguity and overloaded.
4327 SourceLocation Loc,
4328 LookupNameKind NameKind,
4329 RedeclarationKind Redecl
4331 bool LookupBuiltin(LookupResult &R);
4332 void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID);
4333 bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation = false,
4334 bool ForceNoCPlusPlus = false);
4335 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4336 bool InUnqualifiedLookup = false);
4337 bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
4338 CXXScopeSpec &SS);
4340 bool AllowBuiltinCreation = false,
4341 bool EnteringContext = false);
4343 RedeclarationKind Redecl
4345 bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class);
4346
4348 UnresolvedSetImpl &Functions);
4349
4351 SourceLocation GnuLabelLoc = SourceLocation());
4352
4356 unsigned Quals);
4357 CXXMethodDecl *LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals,
4358 bool RValueThis, unsigned ThisQuals);
4360 unsigned Quals);
4361 CXXMethodDecl *LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals,
4362 bool RValueThis, unsigned ThisQuals);
4364
4365 bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id,
4366 bool IsUDSuffix);
4369 bool AllowRaw, bool AllowTemplate,
4370 bool AllowStringTemplate, bool DiagnoseMissing,
4371 StringLiteral *StringLit = nullptr);
4372 bool isKnownName(StringRef name);
4373
4374 /// Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
4376 Emitted,
4377 CUDADiscarded, // Discarded due to CUDA/HIP hostness
4378 OMPDiscarded, // Discarded due to OpenMP hostness
4379 TemplateDiscarded, // Discarded due to uninstantiated templates
4380 Unknown,
4381 };
4382 FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl,
4383 bool Final = false);
4384
4385 // Whether the callee should be ignored in CUDA/HIP/OpenMP host/device check.
4387
4389 ArrayRef<Expr *> Args, ADLResult &Functions);
4390
4391 void LookupVisibleDecls(Scope *S, LookupNameKind Kind,
4393 bool IncludeGlobalScope = true,
4394 bool LoadExternal = true);
4395 void LookupVisibleDecls(DeclContext *Ctx, LookupNameKind Kind,
4397 bool IncludeGlobalScope = true,
4398 bool IncludeDependentBases = false,
4399 bool LoadExternal = true);
4400
4402 CTK_NonError, // CorrectTypo used in a non error recovery situation.
4403 CTK_ErrorRecovery // CorrectTypo used in normal error recovery.
4405
4407 Sema::LookupNameKind LookupKind,
4408 Scope *S, CXXScopeSpec *SS,
4410 CorrectTypoKind Mode,
4411 DeclContext *MemberContext = nullptr,
4412 bool EnteringContext = false,
4413 const ObjCObjectPointerType *OPT = nullptr,
4414 bool RecordFailure = true);
4415
4417 Sema::LookupNameKind LookupKind, Scope *S,
4418 CXXScopeSpec *SS,
4422 DeclContext *MemberContext = nullptr,
4423 bool EnteringContext = false,
4424 const ObjCObjectPointerType *OPT = nullptr);
4425
4426 /// Process any TypoExprs in the given Expr and its children,
4427 /// generating diagnostics as appropriate and returning a new Expr if there
4428 /// were typos that were all successfully corrected and ExprError if one or
4429 /// more typos could not be corrected.
4430 ///
4431 /// \param E The Expr to check for TypoExprs.
4432 ///
4433 /// \param InitDecl A VarDecl to avoid because the Expr being corrected is its
4434 /// initializer.
4435 ///
4436 /// \param RecoverUncorrectedTypos If true, when typo correction fails, it
4437 /// will rebuild the given Expr with all TypoExprs degraded to RecoveryExprs.
4438 ///
4439 /// \param Filter A function applied to a newly rebuilt Expr to determine if
4440 /// it is an acceptable/usable result from a single combination of typo
4441 /// corrections. As long as the filter returns ExprError, different
4442 /// combinations of corrections will be tried until all are exhausted.
4444 Expr *E, VarDecl *InitDecl = nullptr,
4445 bool RecoverUncorrectedTypos = false,
4446 llvm::function_ref<ExprResult(Expr *)> Filter =
4447 [](Expr *E) -> ExprResult { return E; });
4448
4450 ExprResult ER, VarDecl *InitDecl = nullptr,
4451 bool RecoverUncorrectedTypos = false,
4452 llvm::function_ref<ExprResult(Expr *)> Filter =
4453 [](Expr *E) -> ExprResult { return E; }) {
4454 return ER.isInvalid()
4455 ? ER
4456 : CorrectDelayedTyposInExpr(ER.get(), InitDecl,
4457 RecoverUncorrectedTypos, Filter);
4458 }
4459
4460 void diagnoseTypo(const TypoCorrection &Correction,
4461 const PartialDiagnostic &TypoDiag,
4462 bool ErrorRecovery = true);
4463
4464 void diagnoseTypo(const TypoCorrection &Correction,
4465 const PartialDiagnostic &TypoDiag,
4466 const PartialDiagnostic &PrevNote,
4467 bool ErrorRecovery = true);
4468
4469 void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F);
4470
4471 void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc,
4472 ArrayRef<Expr *> Args,
4473 AssociatedNamespaceSet &AssociatedNamespaces,
4474 AssociatedClassSet &AssociatedClasses);
4475
4476 void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S,
4477 bool ConsiderLinkage, bool AllowInlineNamespace);
4478
4479 bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old);
4480 bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old);
4481 bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old);
4482 bool IsRedefinitionInModule(const NamedDecl *New,
4483 const NamedDecl *Old) const;
4484
4485 void DiagnoseAmbiguousLookup(LookupResult &Result);
4486 //@}
4487
4488 /// Attempts to produce a RecoveryExpr after some AST node cannot be created.
4489 ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End,
4490 ArrayRef<Expr *> SubExprs,
4491 QualType T = QualType());
4492
4493 ObjCInterfaceDecl *getObjCInterfaceDecl(IdentifierInfo *&Id,
4494 SourceLocation IdLoc,
4495 bool TypoCorrection = false);
4496 FunctionDecl *CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID,
4497 SourceLocation Loc);
4498 NamedDecl *LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID,
4499 Scope *S, bool ForRedeclaration,
4500 SourceLocation Loc);
4501 NamedDecl *ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II,
4502 Scope *S);
4504 FunctionDecl *FD);
4505 void AddKnownFunctionAttributes(FunctionDecl *FD);
4506
4507 // More parsing and symbol table subroutines.
4508
4509 void ProcessPragmaWeak(Scope *S, Decl *D);
4510 // Decl attributes - this routine is the top level dispatcher.
4511 void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD);
4512 // Helper for delayed processing of attributes.
4513 void ProcessDeclAttributeDelayed(Decl *D,
4514 const ParsedAttributesView &AttrList);
4515
4516 // Options for ProcessDeclAttributeList().
4520
4526
4532
4533 // Should C++11 attributes be processed?
4535
4536 // Should any type attributes encountered be ignored?
4537 // If this option is false, a diagnostic will be emitted for any type
4538 // attributes of a kind that does not "slide" from the declaration to
4539 // the decl-specifier-seq.
4541 };
4542
4544 const ParsedAttributesView &AttrList,
4545 const ProcessDeclAttributeOptions &Options =
4548 const ParsedAttributesView &AttrList);
4549
4551
4552 /// Handles semantic checking for features that are common to all attributes,
4553 /// such as checking whether a parameter was properly specified, or the
4554 /// correct number of arguments were passed, etc. Returns true if the
4555 /// attribute has been diagnosed.
4556 bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A,
4557 bool SkipArgCountCheck = false);
4558 bool checkCommonAttributeFeatures(const Stmt *S, const ParsedAttr &A,
4559 bool SkipArgCountCheck = false);
4560
4561 /// Determine if type T is a valid subject for a nonnull and similar
4562 /// attributes. By default, we look through references (the behavior used by
4563 /// nonnull), but if the second parameter is true, then we treat a reference
4564 /// type as valid.
4565 bool isValidPointerAttrType(QualType T, bool RefOkay = false);
4566
4567 bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value);
4568 bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC,
4569 const FunctionDecl *FD = nullptr);
4570 bool CheckAttrTarget(const ParsedAttr &CurrAttr);
4571 bool CheckAttrNoArgs(const ParsedAttr &CurrAttr);
4573 const Expr *E, StringRef &Str,
4574 SourceLocation *ArgLocation = nullptr);
4575 bool checkStringLiteralArgumentAttr(const ParsedAttr &Attr, unsigned ArgNum,
4576 StringRef &Str,
4577 SourceLocation *ArgLocation = nullptr);
4578 llvm::Error isValidSectionSpecifier(StringRef Str);
4579 bool checkSectionName(SourceLocation LiteralLoc, StringRef Str);
4580 bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str);
4581 bool checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str,
4582 const StringLiteral *Literal,
4583 bool &HasDefault, bool &HasCommas,
4586 CXXRecordDecl *RD, SourceRange Range, bool BestCase,
4587 MSInheritanceModel SemanticSpelling);
4588
4590
4591 /// Adjust the calling convention of a method to be the ABI default if it
4592 /// wasn't specified explicitly. This handles method types formed from
4593 /// function type typedefs and typename template arguments.
4594 void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor,
4595 SourceLocation Loc);
4596
4597 // Check if there is an explicit attribute, but only look through parens.
4598 // The intent is to look for an attribute on the current declarator, but not
4599 // one that came from a typedef.
4601
4602 /// Get the outermost AttributedType node that sets a calling convention.
4603 /// Valid types should not have multiple attributes with different CCs.
4605
4606 /// Process the attributes before creating an attributed statement. Returns
4607 /// the semantic attributes that have been processed.
4608 void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs,
4610
4612 ObjCMethodDecl *MethodDecl,
4613 bool IsProtocolMethodDecl);
4614
4616 ObjCMethodDecl *Overridden,
4617 bool IsProtocolMethodDecl);
4618
4619 /// WarnExactTypedMethods - This routine issues a warning if method
4620 /// implementation declaration matches exactly that of its declaration.
4622 ObjCMethodDecl *MethodDecl,
4623 bool IsProtocolMethodDecl);
4624
4626
4627 /// CheckImplementationIvars - This routine checks if the instance variables
4628 /// listed in the implelementation match those listed in the interface.
4630 ObjCIvarDecl **Fields, unsigned nIvars,
4631 SourceLocation Loc);
4632
4633 /// ImplMethodsVsClassMethods - This is main routine to warn if any method
4634 /// remains unimplemented in the class or category \@implementation.
4636 ObjCContainerDecl* IDecl,
4637 bool IncompleteImpl = false);
4638
4639 /// DiagnoseUnimplementedProperties - This routine warns on those properties
4640 /// which must be implemented by this implementation.
4642 ObjCContainerDecl *CDecl,
4643 bool SynthesizeProperties);
4644
4645 /// Diagnose any null-resettable synthesized setters.
4647
4648 /// DefaultSynthesizeProperties - This routine default synthesizes all
4649 /// properties which must be synthesized in the class's \@implementation.
4651 ObjCInterfaceDecl *IDecl,
4652 SourceLocation AtEnd);
4654
4655 /// IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is
4656 /// an ivar synthesized for 'Method' and 'Method' is a property accessor
4657 /// declared in class 'IFace'.
4659 ObjCMethodDecl *Method, ObjCIvarDecl *IV);
4660
4661 /// DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which
4662 /// backs the property is not used in the property's accessor.
4664 const ObjCImplementationDecl *ImplD);
4665
4666 /// GetIvarBackingPropertyAccessor - If method is a property setter/getter and
4667 /// it property has a backing ivar, returns this ivar; otherwise, returns NULL.
4668 /// It also returns ivar's property on success.
4670 const ObjCPropertyDecl *&PDecl) const;
4671
4672 /// Called by ActOnProperty to handle \@property declarations in
4673 /// class extensions.
4675 SourceLocation AtLoc,
4676 SourceLocation LParenLoc,
4677 FieldDeclarator &FD,
4678 Selector GetterSel,
4679 SourceLocation GetterNameLoc,
4680 Selector SetterSel,
4681 SourceLocation SetterNameLoc,
4682 const bool isReadWrite,
4683 unsigned &Attributes,
4684 const unsigned AttributesAsWritten,
4685 QualType T,
4686 TypeSourceInfo *TSI,
4687 tok::ObjCKeywordKind MethodImplKind);
4688
4689 /// Called by ActOnProperty and HandlePropertyInClassExtension to
4690 /// handle creating the ObjcPropertyDecl for a category or \@interface.
4692 ObjCContainerDecl *CDecl,
4693 SourceLocation AtLoc,
4694 SourceLocation LParenLoc,
4695 FieldDeclarator &FD,
4696 Selector GetterSel,
4697 SourceLocation GetterNameLoc,
4698 Selector SetterSel,
4699 SourceLocation SetterNameLoc,
4700 const bool isReadWrite,
4701 const unsigned Attributes,
4702 const unsigned AttributesAsWritten,
4703 QualType T,
4704 TypeSourceInfo *TSI,
4705 tok::ObjCKeywordKind MethodImplKind,
4706 DeclContext *lexicalDC = nullptr);
4707
4708 /// AtomicPropertySetterGetterRules - This routine enforces the rule (via
4709 /// warning) when atomic property has one but not the other user-declared
4710 /// setter or getter.
4712 ObjCInterfaceDecl* IDecl);
4713
4715
4717 const ObjCImplementationDecl *ImplD,
4718 const ObjCInterfaceDecl *IFD);
4719
4721
4726
4727 /// MatchTwoMethodDeclarations - Checks if two methods' type match and returns
4728 /// true, or false, accordingly.
4729 bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method,
4730 const ObjCMethodDecl *PrevMethod,
4731 MethodMatchStrategy strategy = MMS_strict);
4732
4733 /// MatchAllMethodDeclarations - Check methods declaraed in interface or
4734 /// or protocol against those declared in their implementations.
4735 void MatchAllMethodDeclarations(const SelectorSet &InsMap,
4736 const SelectorSet &ClsMap,
4737 SelectorSet &InsMapSeen,
4738 SelectorSet &ClsMapSeen,
4739 ObjCImplDecl* IMPDecl,
4740 ObjCContainerDecl* IDecl,
4741 bool &IncompleteImpl,
4742 bool ImmediateClass,
4743 bool WarnCategoryMethodImpl=false);
4744
4745 /// CheckCategoryVsClassMethodMatches - Checks that methods implemented in
4746 /// category matches with those implemented in its primary class and
4747 /// warns each time an exact match is found.
4749
4750 /// Add the given method to the list of globally-known methods.
4752
4753 /// Returns default addr space for method qualifiers.
4755
4756private:
4757 /// AddMethodToGlobalPool - Add an instance or factory method to the global
4758 /// pool. See descriptoin of AddInstanceMethodToGlobalPool.
4759 void AddMethodToGlobalPool(ObjCMethodDecl *Method, bool impl, bool instance);
4760
4761 /// LookupMethodInGlobalPool - Returns the instance or factory method and
4762 /// optionally warns if there are multiple signatures.
4763 ObjCMethodDecl *LookupMethodInGlobalPool(Selector Sel, SourceRange R,
4764 bool receiverIdOrClass,
4765 bool instance);
4766
4767public:
4768 /// - Returns instance or factory methods in global method pool for
4769 /// given selector. It checks the desired kind first, if none is found, and
4770 /// parameter checkTheOther is set, it then checks the other kind. If no such
4771 /// method or only one method is found, function returns false; otherwise, it
4772 /// returns true.
4773 bool
4776 bool InstanceFirst, bool CheckTheOther,
4777 const ObjCObjectType *TypeBound = nullptr);
4778
4779 bool
4781 SourceRange R, bool receiverIdOrClass,
4783
4784 void
4786 Selector Sel, SourceRange R,
4787 bool receiverIdOrClass);
4788
4789private:
4790 /// - Returns a selector which best matches given argument list or
4791 /// nullptr if none could be found
4792 ObjCMethodDecl *SelectBestMethod(Selector Sel, MultiExprArg Args,
4793 bool IsInstance,
4795
4796
4797 /// Record the typo correction failure and return an empty correction.
4798 TypoCorrection FailedCorrection(IdentifierInfo *Typo, SourceLocation TypoLoc,
4799 bool RecordFailure = true) {
4800 if (RecordFailure)
4801 TypoCorrectionFailures[Typo].insert(TypoLoc);
4802 return TypoCorrection();
4803 }
4804
4805public:
4806 /// AddInstanceMethodToGlobalPool - All instance methods in a translation
4807 /// unit are added to a global pool. This allows us to efficiently associate
4808 /// a selector with a method declaraation for purposes of typechecking
4809 /// messages sent to "id" (where the class of the object is unknown).
4810 void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4811 AddMethodToGlobalPool(Method, impl, /*instance*/true);
4812 }
4813
4814 /// AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
4815 void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false) {
4816 AddMethodToGlobalPool(Method, impl, /*instance*/false);
4817 }
4818
4819 /// AddAnyMethodToGlobalPool - Add any method, instance or factory to global
4820 /// pool.
4822
4823 /// LookupInstanceMethodInGlobalPool - Returns the method and warns if
4824 /// there are multiple signatures.
4826 bool receiverIdOrClass=false) {
4827 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
4828 /*instance*/true);
4829 }
4830
4831 /// LookupFactoryMethodInGlobalPool - Returns the method and warns if
4832 /// there are multiple signatures.
4834 bool receiverIdOrClass=false) {
4835 return LookupMethodInGlobalPool(Sel, R, receiverIdOrClass,
4836 /*instance*/false);
4837 }
4838
4840 QualType ObjectType=QualType());
4841 /// LookupImplementedMethodInGlobalPool - Returns the method which has an
4842 /// implementation.
4844
4845 /// CollectIvarsToConstructOrDestruct - Collect those ivars which require
4846 /// initialization.
4849
4850 //===--------------------------------------------------------------------===//
4851 // Statement Parsing Callbacks: SemaStmt.cpp.
4852public:
4854 public:
4855 FullExprArg() : E(nullptr) { }
4856 FullExprArg(Sema &actions) : E(nullptr) { }
4857
4859 return E;
4860 }
4861
4862 Expr *get() const { return E; }
4863
4865 return E;
4866 }
4867
4868 private:
4869 // FIXME: No need to make the entire Sema class a friend when it's just
4870 // Sema::MakeFullExpr that needs access to the constructor below.
4871 friend class Sema;
4872
4873 explicit FullExprArg(Expr *expr) : E(expr) {}
4874
4875 Expr *E;
4876 };
4877
4879 return MakeFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation());
4880 }
4882 return FullExprArg(
4883 ActOnFinishFullExpr(Arg, CC, /*DiscardedValue*/ false).get());
4884 }
4886 ExprResult FE =
4887 ActOnFinishFullExpr(Arg, Arg ? Arg->getExprLoc() : SourceLocation(),
4888 /*DiscardedValue*/ true);
4889 return FullExprArg(FE.get());
4890 }
4891
4892 StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue = true);
4894
4896 bool HasLeadingEmptyMacro = false);
4897
4898 void ActOnStartOfCompoundStmt(bool IsStmtExpr);
4902 ArrayRef<Stmt *> Elts, bool isStmtExpr);
4903
4904 /// A RAII object to enter scope of a compound statement.
4906 public:
4907 CompoundScopeRAII(Sema &S, bool IsStmtExpr = false) : S(S) {
4908 S.ActOnStartOfCompoundStmt(IsStmtExpr);
4909 }
4910
4912 S.ActOnFinishOfCompoundStmt();
4913 }
4914
4915 private:
4916 Sema &S;
4917 };
4918
4919 /// An RAII helper that pops function a function scope on exit.
4925 if (Active)
4927 }
4928 void disable() { Active = false; }
4929 };
4930
4932 SourceLocation StartLoc,
4933 SourceLocation EndLoc);
4938 SourceLocation DotDotDotLoc, ExprResult RHS,
4939 SourceLocation ColonLoc);
4940 void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt);
4941
4943 SourceLocation ColonLoc,
4944 Stmt *SubStmt, Scope *CurScope);
4946 SourceLocation ColonLoc, Stmt *SubStmt);
4947
4949 ArrayRef<const Attr *> Attrs, Stmt *SubStmt);
4951 Stmt *SubStmt);
4952
4953 class ConditionResult;
4954
4956 SourceLocation LParenLoc, Stmt *InitStmt,
4957 ConditionResult Cond, SourceLocation RParenLoc,
4958 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
4960 SourceLocation LParenLoc, Stmt *InitStmt,
4961 ConditionResult Cond, SourceLocation RParenLoc,
4962 Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal);
4964 SourceLocation LParenLoc, Stmt *InitStmt,
4965 ConditionResult Cond,
4966 SourceLocation RParenLoc);
4968 Stmt *Switch, Stmt *Body);
4970 ConditionResult Cond, SourceLocation RParenLoc,
4971 Stmt *Body);
4973 SourceLocation WhileLoc, SourceLocation CondLParen,
4974 Expr *Cond, SourceLocation CondRParen);
4975
4977 SourceLocation LParenLoc,
4978 Stmt *First,
4979 ConditionResult Second,
4980 FullExprArg Third,
4981 SourceLocation RParenLoc,
4982 Stmt *Body);
4984 Expr *collection);
4986 Stmt *First, Expr *collection,
4987 SourceLocation RParenLoc);
4988 StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
4989
4991 /// Initial building of a for-range statement.
4993 /// Instantiation or recovery rebuild of a for-range statement. Don't
4994 /// attempt any typo-correction.
4996 /// Determining whether a for-range statement could be built. Avoid any
4997 /// unnecessary or irreversible actions.
5000
5002 SourceLocation CoawaitLoc,
5003 Stmt *InitStmt,
5004 Stmt *LoopVar,
5005 SourceLocation ColonLoc, Expr *Collection,
5006 SourceLocation RParenLoc,
5007 BuildForRangeKind Kind);
5009 SourceLocation CoawaitLoc,
5010 Stmt *InitStmt,
5011 SourceLocation ColonLoc,
5012 Stmt *RangeDecl, Stmt *Begin, Stmt *End,
5013 Expr *Cond, Expr *Inc,
5014 Stmt *LoopVarDecl,
5015 SourceLocation RParenLoc,
5016 BuildForRangeKind Kind);
5017 StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body);
5018
5020 SourceLocation LabelLoc,
5021 LabelDecl *TheDecl);
5023 SourceLocation StarLoc,
5024 Expr *DestExp);
5025 StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope);
5026 StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope);
5027
5028 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
5029 CapturedRegionKind Kind, unsigned NumParams);
5030 typedef std::pair<StringRef, QualType> CapturedParamNameType;
5031 void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope,
5032 CapturedRegionKind Kind,
5034 unsigned OpenMPCaptureLevel = 0);
5038 SourceLocation Loc,
5039 unsigned NumParams);
5040
5043
5046
5047 bool isMoveEligible() const { return S != None; };
5049 };
5051 NamedReturnInfo getNamedReturnInfo(
5053 NamedReturnInfo getNamedReturnInfo(const VarDecl *VD);
5054 const VarDecl *getCopyElisionCandidate(NamedReturnInfo &Info,
5055 QualType ReturnType);
5056
5059 const NamedReturnInfo &NRInfo, Expr *Value,
5060 bool SupressSimplerImplicitMoves = false);
5061
5062 StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
5063 Scope *CurScope);
5064 StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp,
5065 bool AllowRecovery = false);
5067 NamedReturnInfo &NRInfo,
5068 bool SupressSimplerImplicitMoves);
5069
5070 StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple,
5071 bool IsVolatile, unsigned NumOutputs,
5072 unsigned NumInputs, IdentifierInfo **Names,
5073 MultiExprArg Constraints, MultiExprArg Exprs,
5074 Expr *AsmString, MultiExprArg Clobbers,
5075 unsigned NumLabels,
5076 SourceLocation RParenLoc);
5077
5079 llvm::InlineAsmIdentifierInfo &Info);
5081 SourceLocation TemplateKWLoc,
5083 bool IsUnevaluatedContext);
5084 bool LookupInlineAsmField(StringRef Base, StringRef Member,
5085 unsigned &Offset, SourceLocation AsmLoc);
5087 SourceLocation AsmLoc);
5089 ArrayRef<Token> AsmToks,
5090 StringRef AsmString,
5091 unsigned NumOutputs, unsigned NumInputs,
5092 ArrayRef<StringRef> Constraints,
5093 ArrayRef<StringRef> Clobbers,
5094 ArrayRef<Expr*> Exprs,
5095 SourceLocation EndLoc);
5096 LabelDecl *GetOrCreateMSAsmLabel(StringRef ExternalLabelName,
5097 SourceLocation Location,
5098 bool AlwaysCreate);
5099
5101 SourceLocation StartLoc,
5103 bool Invalid = false);
5104
5106
5108 Decl *Parm, Stmt *Body);
5109
5111
5113 MultiStmtArg Catch, Stmt *Finally);
5114
5117 Scope *CurScope);
5119 Expr *operand);
5121 Expr *SynchExpr,
5122 Stmt *SynchBody);
5123
5125
5127 SourceLocation StartLoc,
5128 SourceLocation IdLoc,
5130
5132
5134 Decl *ExDecl, Stmt *HandlerBlock);
5136 ArrayRef<Stmt *> Handlers);
5137
5138 StmtResult ActOnSEHTryBlock(bool IsCXXTry, // try (true) or __try (false) ?
5139 SourceLocation TryLoc, Stmt *TryBlock,
5140 Stmt *Handler);
5142 Expr *FilterExpr,
5143 Stmt *Block);
5148
5150
5152
5153 /// If it's a file scoped decl that must warn if not used, keep track
5154 /// of it.
5156
5157 /// DiagnoseUnusedExprResult - If the statement passed in is an expression
5158 /// whose result is unused, warn.
5159 void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID);
5161 void DiagnoseUnusedDecl(const NamedDecl *ND);
5162
5163 /// If VD is set but not otherwise used, diagnose, for a parameter or a
5164 /// variable.
5165 void DiagnoseUnusedButSetDecl(const VarDecl *VD);
5166
5167 /// Emit \p DiagID if statement located on \p StmtLoc has a suspicious null
5168 /// statement as a \p Body, and it is located on the same line.
5169 ///
5170 /// This helps prevent bugs due to typos, such as:
5171 /// if (condition);
5172 /// do_stuff();
5174 const Stmt *Body,
5175 unsigned DiagID);
5176
5177 /// Warn if a for/while loop statement \p S, which is followed by
5178 /// \p PossibleBody, has a suspicious null statement as a body.
5179 void DiagnoseEmptyLoopBody(const Stmt *S,
5180 const Stmt *PossibleBody);
5181
5182 /// Warn if a value is moved to itself.
5183 void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr,
5184 SourceLocation OpLoc);
5185
5186 /// Returns a field in a CXXRecordDecl that has the same name as the decl \p
5187 /// SelfAssigned when inside a CXXMethodDecl.
5188 const FieldDecl *
5190
5191 /// Warn if we're implicitly casting from a _Nullable pointer type to a
5192 /// _Nonnull one.
5194 SourceLocation Loc);
5195
5196 /// Warn when implicitly casting 0 to nullptr.
5197 void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E);
5198
5203
5206 ParsingClassDepth++;
5208 }
5210 ParsingClassDepth--;
5212 }
5213
5215
5217 const ObjCInterfaceDecl *UnknownObjCClass,
5218 bool ObjCPropertyAccess,
5219 bool AvoidPartialAvailabilityChecks = false,
5220 ObjCInterfaceDecl *ClassReceiver = nullptr);
5221
5223 UnavailableAttr::ImplicitReason reason);
5224
5225 /// Issue any -Wunguarded-availability warnings in \c FD
5227
5229
5230 //===--------------------------------------------------------------------===//
5231 // Expression Parsing Callbacks: SemaExpr.cpp.
5232
5233 bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid);
5235 const ObjCInterfaceDecl *UnknownObjCClass = nullptr,
5236 bool ObjCPropertyAccess = false,
5237 bool AvoidPartialAvailabilityChecks = false,
5238 ObjCInterfaceDecl *ClassReciever = nullptr);
5242 ObjCMethodDecl *Getter,
5243 SourceLocation Loc);
5245 ArrayRef<Expr *> Args);
5246
5248 ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl = nullptr,
5253 ExpressionEvaluationContext NewContext, ReuseLambdaContextDecl_t,
5257
5259
5263
5266
5268
5269 // Functions for marking a declaration referenced. These functions also
5270 // contain the relevant logic for marking if a reference to a function or
5271 // variable is an odr-use (in the C++11 sense). There are separate variants
5272 // for expressions referring to a decl; these exist because odr-use marking
5273 // needs to be delayed for some constant variables when we build one of the
5274 // named expressions.
5275 //
5276 // MightBeOdrUse indicates whether the use could possibly be an odr-use, and
5277 // should usually be true. This only needs to be set to false if the lack of
5278 // odr-use cannot be determined from the current context (for instance,
5279 // because the name denotes a virtual function and was written without an
5280 // explicit nested-name-specifier).
5281 void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse);
5283 bool MightBeOdrUse = true);
5285 void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base = nullptr);
5289 unsigned CapturingScopeIndex);
5290
5292 void CleanupVarDeclMarking();
5293
5297
5298 /// Try to capture the given variable.
5299 ///
5300 /// \param Var The variable to capture.
5301 ///
5302 /// \param Loc The location at which the capture occurs.
5303 ///
5304 /// \param Kind The kind of capture, which may be implicit (for either a
5305 /// block or a lambda), or explicit by-value or by-reference (for a lambda).
5306 ///
5307 /// \param EllipsisLoc The location of the ellipsis, if one is provided in
5308 /// an explicit lambda capture.
5309 ///
5310 /// \param BuildAndDiagnose Whether we are actually supposed to add the
5311 /// captures or diagnose errors. If false, this routine merely check whether
5312 /// the capture can occur without performing the capture itself or complaining
5313 /// if the variable cannot be captured.
5314 ///
5315 /// \param CaptureType Will be set to the type of the field used to capture
5316 /// this variable in the innermost block or lambda. Only valid when the
5317 /// variable can be captured.
5318 ///
5319 /// \param DeclRefType Will be set to the type of a reference to the capture
5320 /// from within the current scope. Only valid when the variable can be
5321 /// captured.
5322 ///
5323 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
5324 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
5325 /// This is useful when enclosing lambdas must speculatively capture
5326 /// variables that may or may not be used in certain specializations of
5327 /// a nested generic lambda.
5328 ///
5329 /// \returns true if an error occurred (i.e., the variable cannot be
5330 /// captured) and false if the capture succeeded.
5332 SourceLocation EllipsisLoc, bool BuildAndDiagnose,
5333 QualType &CaptureType,
5334 QualType &DeclRefType,
5335 const unsigned *const FunctionScopeIndexToStopAt);
5336
5337 /// Try to capture the given variable.
5340 SourceLocation EllipsisLoc = SourceLocation());
5341
5342 /// Checks if the variable must be captured.
5344
5345 /// Given a variable, determine the type that a reference to that
5346 /// variable will have in the given scope.
5348
5349 /// Mark all of the declarations referenced within a particular AST node as
5350 /// referenced. Used when template instantiation instantiates a non-dependent
5351 /// type -- entities referenced by the type are now referenced.
5354 bool SkipLocalVariables = false,
5355 ArrayRef<const Expr *> StopAt = None);
5356
5357 /// Try to recover by turning the given expression into a
5358 /// call. Returns true if recovery was attempted or an error was
5359 /// emitted; this may also leave the ExprResult invalid.
5361 bool ForceComplain = false,
5362 bool (*IsPlausibleResult)(QualType) = nullptr);
5363
5364 /// Figure out if an expression could be turned into a call.
5365 bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy,
5366 UnresolvedSetImpl &NonTemplateOverloads);
5367
5368 /// Try to convert an expression \p E to type \p Ty. Returns the result of the
5369 /// conversion.
5371
5372 /// Conditionally issue a diagnostic based on the statements's reachability
5373 /// analysis.
5374 ///
5375 /// \param Stmts If Stmts is non-empty, delay reporting the diagnostic until
5376 /// the function body is parsed, and then do a basic reachability analysis to
5377 /// determine if the statement is reachable. If it is unreachable, the
5378 /// diagnostic will not be emitted.
5380 const PartialDiagnostic &PD);
5381
5382 /// Conditionally issue a diagnostic based on the current
5383 /// evaluation context.
5384 ///
5385 /// \param Statement If Statement is non-null, delay reporting the
5386 /// diagnostic until the function body is parsed, and then do a basic
5387 /// reachability analysis to determine if the statement is reachable.
5388 /// If it is unreachable, the diagnostic will not be emitted.
5389 bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement,
5390 const PartialDiagnostic &PD);
5391 /// Similar, but diagnostic is only produced if all the specified statements
5392 /// are reachable.
5394 const PartialDiagnostic &PD);
5395
5396 // Primary Expressions.
5397 SourceRange getExprRange(Expr *E) const;
5398
5400 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5401 UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand,
5402 CorrectionCandidateCallback *CCC = nullptr,
5403 bool IsInlineAsmIdentifier = false, Token *KeywordReplacement = nullptr);
5404
5407 DeclarationNameInfo &NameInfo,
5408 const TemplateArgumentListInfo *&TemplateArgs);
5409
5411
5412 bool
5415 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr,
5416 ArrayRef<Expr *> Args = None, TypoExpr **Out = nullptr);
5417
5419 IdentifierInfo *II);
5421
5423 IdentifierInfo *II,
5424 bool AllowBuiltinCreation=false);
5425
5427 SourceLocation TemplateKWLoc,
5428 const DeclarationNameInfo &NameInfo,
5429 bool isAddressOfOperand,
5430 const TemplateArgumentListInfo *TemplateArgs);
5431
5432 /// If \p D cannot be odr-used in the current expression evaluation context,
5433 /// return a reason explaining why. Otherwise, return NOUR_None.
5435
5437 SourceLocation Loc,
5438 const CXXScopeSpec *SS = nullptr);
5439 DeclRefExpr *
5441 const DeclarationNameInfo &NameInfo,
5442 const CXXScopeSpec *SS = nullptr,
5443 NamedDecl *FoundD = nullptr,
5444 SourceLocation TemplateKWLoc = SourceLocation(),
5445 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5446 DeclRefExpr *
5448 const DeclarationNameInfo &NameInfo,
5450 NamedDecl *FoundD = nullptr,
5451 SourceLocation TemplateKWLoc = SourceLocation(),
5452 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5453
5456 const CXXScopeSpec &SS,
5457 SourceLocation nameLoc,
5458 IndirectFieldDecl *indirectField,
5459 DeclAccessPair FoundDecl = DeclAccessPair::make(nullptr, AS_none),
5460 Expr *baseObjectExpr = nullptr,
5461 SourceLocation opLoc = SourceLocation());
5462
5464 const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R,
5465 const TemplateArgumentListInfo *TemplateArgs, const Scope *S,
5466 UnresolvedLookupExpr *AsULE = nullptr);
5468 SourceLocation TemplateKWLoc,
5469 LookupResult &R,
5470 const TemplateArgumentListInfo *TemplateArgs,
5471 bool IsDefiniteInstance,
5472 const Scope *S);
5474 const LookupResult &R,
5475 bool HasTrailingLParen);
5476
5479 const DeclarationNameInfo &NameInfo,
5480 bool IsAddressOfOperand, const Scope *S,
5481 TypeSourceInfo **RecoveryTSI = nullptr);
5482
5484 SourceLocation TemplateKWLoc,
5485 const DeclarationNameInfo &NameInfo,
5486 const TemplateArgumentListInfo *TemplateArgs);
5487
5489 LookupResult &R,
5490 bool NeedsADL,
5491 bool AcceptInvalidDecl = false);
5493 const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, NamedDecl *D,
5494 NamedDecl *FoundD = nullptr,
5495 const TemplateArgumentListInfo *TemplateArgs = nullptr,
5496 bool AcceptInvalidDecl = false);
5497
5499 DeclarationNameInfo &SuffixInfo,
5500 ArrayRef<Expr *> Args,
5501 SourceLocation LitEndLoc,
5502 TemplateArgumentListInfo *ExplicitTemplateArgs = nullptr);
5503
5508
5510 SourceLocation LParen,
5511 SourceLocation RParen,
5512 TypeSourceInfo *TSI);
5514 SourceLocation LParen,
5515 SourceLocation RParen,
5516 ParsedType ParsedTy);
5517
5519
5520 ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope = nullptr);
5522 Scope *UDLScope = nullptr);
5526 MultiExprArg Val);
5527
5528 /// ActOnStringLiteral - The specified tokens were lexed as pasted string
5529 /// fragments (e.g. "foo" "bar" L"baz").
5531 Scope *UDLScope = nullptr);
5532
5534 SourceLocation DefaultLoc,
5535 SourceLocation RParenLoc,
5536 Expr *ControllingExpr,
5537 ArrayRef<ParsedType> ArgTypes,
5538 ArrayRef<Expr *> ArgExprs);
5540 SourceLocation DefaultLoc,
5541 SourceLocation RParenLoc,
5542 Expr *ControllingExpr,
5544 ArrayRef<Expr *> Exprs);
5545
5546 // Binary/Unary Operators. 'Tok' is the token for the operator.
5548 Expr *InputExpr);
5550 UnaryOperatorKind Opc, Expr *Input);
5552 tok::TokenKind Op, Expr *Input);
5553
5556
5558 SourceLocation OpLoc,
5559 UnaryExprOrTypeTrait ExprKind,
5560 SourceRange R);
5562 UnaryExprOrTypeTrait ExprKind);
5565 UnaryExprOrTypeTrait ExprKind,
5566 bool IsType, void *TyOrEx,
5567 SourceRange ArgRange);
5568
5570 bool CheckVecStepExpr(Expr *E);
5571
5574 SourceRange ExprRange,
5575 UnaryExprOrTypeTrait ExprKind);
5577 SourceLocation OpLoc,
5578 IdentifierInfo &Name,
5579 SourceLocation NameLoc,
5580 SourceLocation RParenLoc);
5582 tok::TokenKind Kind, Expr *Input);
5583
5585 MultiExprArg ArgExprs,
5586 SourceLocation RLoc);
5588 Expr *Idx, SourceLocation RLoc);
5589
5591 Expr *ColumnIdx,
5592 SourceLocation RBLoc);
5593
5595 Expr *LowerBound,
5596 SourceLocation ColonLocFirst,
5597 SourceLocation ColonLocSecond,
5598 Expr *Length, Expr *Stride,
5599 SourceLocation RBLoc);
5601 SourceLocation RParenLoc,
5602 ArrayRef<Expr *> Dims,
5603 ArrayRef<SourceRange> Brackets);
5604
5605 /// Data structure for iterator expression.
5615
5617 SourceLocation LLoc, SourceLocation RLoc,
5619
5620 // This struct is for use by ActOnMemberAccess to allow
5621 // BuildMemberReferenceExpr to be able to reinvoke ActOnMemberAccess after
5622 // changing the access operator from a '.' to a '->' (to see if that is the
5623 // change needed to fix an error about an unknown member, e.g. when the class
5624 // defines a custom operator->).
5630
5632 Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow,
5633 CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
5634 NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo,
5635 const TemplateArgumentListInfo *TemplateArgs,
5636 const Scope *S,
5637 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5638
5641 bool IsArrow, const CXXScopeSpec &SS,
5642 SourceLocation TemplateKWLoc,
5643 NamedDecl *FirstQualifierInScope, LookupResult &R,
5644 const TemplateArgumentListInfo *TemplateArgs,
5645 const Scope *S,
5646 bool SuppressQualifierCheck = false,
5647 ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
5648
5649 ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow,
5650 SourceLocation OpLoc,
5651 const CXXScopeSpec &SS, FieldDecl *Field,
5652 DeclAccessPair FoundDecl,
5653 const DeclarationNameInfo &MemberNameInfo);
5654
5656
5657 bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType,
5658 const CXXScopeSpec &SS,
5659 const LookupResult &R);
5660
5662 bool IsArrow, SourceLocation OpLoc,
5663 const CXXScopeSpec &SS,
5664 SourceLocation TemplateKWLoc,
5665 NamedDecl *FirstQualifierInScope,
5666 const DeclarationNameInfo &NameInfo,
5667 const TemplateArgumentListInfo *TemplateArgs);
5668
5670 SourceLocation OpLoc,
5671 tok::TokenKind OpKind,
5672 CXXScopeSpec &SS,
5673 SourceLocation TemplateKWLoc,
5675 Decl *ObjCImpDecl);
5676
5677 MemberExpr *
5678 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5679 const CXXScopeSpec *SS, SourceLocation TemplateKWLoc,
5680 ValueDecl *Member, DeclAccessPair FoundDecl,
5681 bool HadMultipleCandidates,
5682 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5684 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5685 MemberExpr *
5686 BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc,
5687 NestedNameSpecifierLoc NNS, SourceLocation TemplateKWLoc,
5688 ValueDecl *Member, DeclAccessPair FoundDecl,
5689 bool HadMultipleCandidates,
5690 const DeclarationNameInfo &MemberNameInfo, QualType Ty,
5692 const TemplateArgumentListInfo *TemplateArgs = nullptr);
5693
5694 void ActOnDefaultCtorInitializers(Decl *CDtorDecl);
5695 bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn,
5696 FunctionDecl *FDecl,
5697 const FunctionProtoType *Proto,
5698 ArrayRef<Expr *> Args,
5699 SourceLocation RParenLoc,
5700 bool ExecConfig = false);
5702 ParmVarDecl *Param,
5703 const Expr *ArgExpr);
5704
5705 /// ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
5706 /// This provides the location of the left/right parens and a list of comma
5707 /// locations.
5709 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5710 Expr *ExecConfig = nullptr);
5712 MultiExprArg ArgExprs, SourceLocation RParenLoc,
5713 Expr *ExecConfig = nullptr,
5714 bool IsExecConfig = false,
5715 bool AllowRecovery = false);
5717 MultiExprArg CallArgs);
5718 enum class AtomicArgumentOrder { API, AST };
5720 BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange,
5721 SourceLocation RParenLoc, MultiExprArg Args,
5725 BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc,
5726 ArrayRef<Expr *> Arg, SourceLocation RParenLoc,
5727 Expr *Config = nullptr, bool IsExecConfig = false,
5728 ADLCallKind UsesADL = ADLCallKind::NotADL);
5729
5731 MultiExprArg ExecConfig,
5732 SourceLocation GGGLoc);
5733
5735 Declarator &D, ParsedType &Ty,
5736 SourceLocation RParenLoc, Expr *CastExpr);
5738 TypeSourceInfo *Ty,
5739 SourceLocation RParenLoc,
5740 Expr *Op);
5742
5743 /// Build an altivec or OpenCL literal.
5745 SourceLocation RParenLoc, Expr *E,
5746 TypeSourceInfo *TInfo);
5747
5749
5751 ParsedType Ty,
5752 SourceLocation RParenLoc,
5753 Expr *InitExpr);
5754
5756 TypeSourceInfo *TInfo,
5757 SourceLocation RParenLoc,
5758 Expr *LiteralExpr);
5759
5761 MultiExprArg InitArgList,
5762 SourceLocation RBraceLoc);
5763
5765 MultiExprArg InitArgList,
5766 SourceLocation RBraceLoc);
5767
5769 SourceLocation EqualOrColonLoc,
5770 bool GNUSyntax,
5771 ExprResult Init);
5772
5773private:
5774 static BinaryOperatorKind ConvertTokenKindToBinaryOpcode(tok::TokenKind Kind);
5775
5776public:
5778 tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr);
5780 BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr);
5782 Expr *LHSExpr, Expr *RHSExpr);
5784 UnresolvedSetImpl &Functions);
5785
5786 void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc);
5787
5788 /// ActOnConditionalOp - Parse a ?: operation. Note that 'LHS' may be null
5789 /// in the case of a the GNU conditional expr extension.
5791 SourceLocation ColonLoc,
5792 Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr);
5793
5794 /// ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
5796 LabelDecl *TheDecl);
5797
5798 void ActOnStartStmtExpr();
5799 ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt,
5800 SourceLocation RPLoc);
5802 SourceLocation RPLoc, unsigned TemplateDepth);
5803 // Handle the final expression in a statement expression.
5805 void ActOnStmtExprError();
5806
5807 // __builtin_offsetof(type, identifier(.identifier|[expr])*)
5810 bool isBrackets; // true if [expr], false if .ident
5811 union {
5814 } U;
5815 };
5816
5817 /// __builtin_offsetof(type, a.b[123][456].c)
5819 TypeSourceInfo *TInfo,
5820 ArrayRef<OffsetOfComponent> Components,
5821 SourceLocation RParenLoc);
5823 SourceLocation BuiltinLoc,
5825 ParsedType ParsedArgTy,
5826 ArrayRef<OffsetOfComponent> Components,
5827 SourceLocation RParenLoc);
5828
5829 // __builtin_choose_expr(constExpr, expr1, expr2)
5831 Expr *CondExpr, Expr *LHSExpr,
5832 Expr *RHSExpr, SourceLocation RPLoc);
5833
5834 // __builtin_va_arg(expr, type)
5836 SourceLocation RPLoc);
5838 TypeSourceInfo *TInfo, SourceLocation RPLoc);
5839
5840 // __builtin_LINE(), __builtin_FUNCTION(), __builtin_FILE(),
5841 // __builtin_COLUMN(), __builtin_source_location()
5843 SourceLocation BuiltinLoc,
5844 SourceLocation RPLoc);
5845
5846 // Build a potentially resolved SourceLocExpr.
5848 QualType ResultTy, SourceLocation BuiltinLoc,
5849 SourceLocation RPLoc,
5850 DeclContext *ParentContext);
5851
5852 // __null
5854
5855 bool CheckCaseExpression(Expr *E);
5856
5857 /// Describes the result of an "if-exists" condition check.
5859 /// The symbol exists.
5861
5862 /// The symbol does not exist.
5864
5865 /// The name is a dependent name, so the results will differ
5866 /// from one instantiation to the next.
5868
5869 /// An error occurred.
5870 IER_Error
5872
5875 const DeclarationNameInfo &TargetNameInfo);
5876
5879 bool IsIfExists, CXXScopeSpec &SS,
5880 UnqualifiedId &Name);
5881
5883 bool IsIfExists,
5884 NestedNameSpecifierLoc QualifierLoc,
5885 DeclarationNameInfo NameInfo,
5886 Stmt *Nested);
5888 bool IsIfExists,
5889 CXXScopeSpec &SS, UnqualifiedId &Name,
5890 Stmt *Nested);
5891
5892 //===------------------------- "Block" Extension ------------------------===//
5893
5894 /// ActOnBlockStart - This callback is invoked when a block literal is
5895 /// started.
5896 void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope);
5897
5898 /// ActOnBlockArguments - This callback allows processing of block arguments.
5899 /// If there are no arguments, this is still invoked.
5900 void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo,
5901 Scope *CurScope);
5902
5903 /// ActOnBlockError - If there is an error parsing a block, this callback
5904 /// is invoked to pop the information about the block from the action impl.
5905 void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope);
5906
5907 /// ActOnBlockStmtExpr - This is called when the body of a block statement
5908 /// literal was successfully completed. ^(int x){...}
5910 Scope *CurScope);
5911
5912 //===---------------------------- Clang Extensions ----------------------===//
5913
5914 /// __builtin_convertvector(...)
5916 SourceLocation BuiltinLoc,
5917 SourceLocation RParenLoc);
5918
5919 //===---------------------------- OpenCL Features -----------------------===//
5920
5921 /// __builtin_astype(...)
5922 ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy,
5923 SourceLocation BuiltinLoc,
5924 SourceLocation RParenLoc);
5926 SourceLocation BuiltinLoc,
5927 SourceLocation RParenLoc);
5928
5929 //===---------------------------- C++ Features --------------------------===//
5930
5931 // Act on C++ namespaces
5933 SourceLocation NamespaceLoc,
5934 SourceLocation IdentLoc, IdentifierInfo *Ident,
5935 SourceLocation LBrace,
5936 const ParsedAttributesView &AttrList,
5938 void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace);
5939
5942
5945
5947 EnumDecl *getStdAlignValT() const;
5948
5949private:
5950 // A cache representing if we've fully checked the various comparison category
5951 // types stored in ASTContext. The bit-index corresponds to the integer value
5952 // of a ComparisonCategoryType enumerator.
5953 llvm::SmallBitVector FullyCheckedComparisonCategories;
5954
5955 ValueDecl *tryLookupCtorInitMemberDecl(CXXRecordDecl *ClassDecl,
5956 CXXScopeSpec &SS,
5957 ParsedType TemplateTypeTy,
5958 IdentifierInfo *MemberOrBase);
5959
5960public:
5962 /// The '<=>' operator was used in an expression and a builtin operator
5963 /// was selected.
5965 /// A defaulted 'operator<=>' needed the comparison category. This
5966 /// typically only applies to 'std::strong_ordering', due to the implicit
5967 /// fallback return value.
5969 };
5970
5971 /// Lookup the specified comparison category types in the standard
5972 /// library, an check the VarDecls possibly returned by the operator<=>
5973 /// builtins for that type.
5974 ///
5975 /// \return The type of the comparison category type corresponding to the
5976 /// specified Kind, or a null type if an error occurs
5978 SourceLocation Loc,
5980
5981 /// Tests whether Ty is an instance of std::initializer_list and, if
5982 /// it is and Element is not NULL, assigns the element type to Element.
5983 bool isStdInitializerList(QualType Ty, QualType *Element);
5984
5985 /// Looks for the std::initializer_list template and instantiates it
5986 /// with Element, or emits an error if it's not found.
5987 ///
5988 /// \returns The instantiated template, or null on error.
5990
5991 /// Determine whether Ctor is an initializer-list constructor, as
5992 /// defined in [dcl.init.list]p2.
5993 bool isInitListConstructor(const FunctionDecl *Ctor);
5994
5995 Decl *ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc,
5996 SourceLocation NamespcLoc, CXXScopeSpec &SS,
5997 SourceLocation IdentLoc,
5998 IdentifierInfo *NamespcName,
5999 const ParsedAttributesView &AttrList);
6000
6002
6004 SourceLocation NamespaceLoc,
6005 SourceLocation AliasLoc,
6006 IdentifierInfo *Alias,
6007 CXXScopeSpec &SS,
6008 SourceLocation IdentLoc,
6009 IdentifierInfo *Ident);
6010
6011 void FilterUsingLookup(Scope *S, LookupResult &lookup);
6012 void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow);
6013 bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target,
6014 const LookupResult &PreviousDecls,
6015 UsingShadowDecl *&PrevShadow);
6017 NamedDecl *Target,
6018 UsingShadowDecl *PrevDecl);
6019
6021 bool HasTypenameKeyword,
6022 const CXXScopeSpec &SS,
6023 SourceLocation NameLoc,
6024 const LookupResult &Previous);
6025 bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename,
6026 const CXXScopeSpec &SS,
6027 const DeclarationNameInfo &NameInfo,
6028 SourceLocation NameLoc,
6029 const LookupResult *R = nullptr,
6030 const UsingDecl *UD = nullptr);
6031
6033 Scope *S, AccessSpecifier AS, SourceLocation UsingLoc,
6034 bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS,
6035 DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc,
6036 const ParsedAttributesView &AttrList, bool IsInstantiation,
6037 bool IsUsingIfExists);
6039 SourceLocation UsingLoc,
6040 SourceLocation EnumLoc,
6041 SourceLocation NameLoc, EnumDecl *ED);
6042 NamedDecl *BuildUsingPackDecl(NamedDecl *InstantiatedFrom,
6043 ArrayRef<NamedDecl *> Expansions);
6044
6046
6047 /// Given a derived-class using shadow declaration for a constructor and the
6048 /// correspnding base class constructor, find or create the implicit
6049 /// synthesized derived class constructor to use for this initialization.
6052 ConstructorUsingShadowDecl *DerivedShadow);
6053
6055 SourceLocation UsingLoc,
6056 SourceLocation TypenameLoc, CXXScopeSpec &SS,
6057 UnqualifiedId &Name, SourceLocation EllipsisLoc,
6058 const ParsedAttributesView &AttrList);
6060 SourceLocation UsingLoc,
6061 SourceLocation EnumLoc, const DeclSpec &);
6063 MultiTemplateParamsArg TemplateParams,
6064 SourceLocation UsingLoc, UnqualifiedId &Name,
6065 const ParsedAttributesView &AttrList,
6066 TypeResult Type, Decl *DeclFromDeclSpec);
6067
6068 /// BuildCXXConstructExpr - Creates a complete call to a constructor,
6069 /// including handling of its default argument expressions.
6070 ///
6071 /// \param ConstructKind - a CXXConstructExpr::ConstructionKind
6073 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6074 NamedDecl *FoundDecl,
6075 CXXConstructorDecl *Constructor, MultiExprArg Exprs,
6076 bool HadMultipleCandidates, bool IsListInitialization,
6077 bool IsStdInitListInitialization,
6078 bool RequiresZeroInit, unsigned ConstructKind,
6079 SourceRange ParenRange);
6080
6081 /// Build a CXXConstructExpr whose constructor has already been resolved if
6082 /// it denotes an inherited constructor.
6084 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6085 CXXConstructorDecl *Constructor, bool Elidable,
6086 MultiExprArg Exprs,
6087 bool HadMultipleCandidates, bool IsListInitialization,
6088 bool IsStdInitListInitialization,
6089 bool RequiresZeroInit, unsigned ConstructKind,
6090 SourceRange ParenRange);
6091
6092 // FIXME: Can we remove this and have the above BuildCXXConstructExpr check if
6093 // the constructor can be elidable?
6095 BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType,
6096 NamedDecl *FoundDecl,
6097 CXXConstructorDecl *Constructor, bool Elidable,
6098 MultiExprArg Exprs, bool HadMultipleCandidates,
6099 bool IsListInitialization,
6100 bool IsStdInitListInitialization, bool RequiresZeroInit,
6101 unsigned ConstructKind, SourceRange ParenRange);
6102
6104
6105
6106 /// Instantiate or parse a C++ default argument expression as necessary.
6107 /// Return true on error.
6109 ParmVarDecl *Param);
6110
6111 /// BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating
6112 /// the default expr if needed.
6114 FunctionDecl *FD,
6115 ParmVarDecl *Param);
6116
6117 /// FinalizeVarWithDestructor - Prepare for calling destructor on the
6118 /// constructed variable.
6119 void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType);
6120
6121 /// Helper class that collects exception specifications for
6122 /// implicitly-declared special member functions.
6124 // Pointer to allow copying
6125 Sema *Self;
6126 // We order exception specifications thus:
6127 // noexcept is the most restrictive, but is only used in C++11.
6128 // throw() comes next.
6129 // Then a throw(collected exceptions)
6130 // Finally no specification, which is expressed as noexcept(false).
6131 // throw(...) is used instead if any called function uses it.
6132 ExceptionSpecificationType ComputedEST;
6133 llvm::SmallPtrSet<CanQualType, 4> ExceptionsSeen;
6134 SmallVector<QualType, 4> Exceptions;
6135
6136 void ClearExceptions() {
6137 ExceptionsSeen.clear();
6138 Exceptions.clear();
6139 }
6140
6141 public:
6143 : Self(&Self), ComputedEST(EST_BasicNoexcept) {
6144 if (!Self.getLangOpts().CPlusPlus11)
6145 ComputedEST = EST_DynamicNone;
6146 }
6147
6148 /// Get the computed exception specification type.
6150 assert(!isComputedNoexcept(ComputedEST) &&
6151 "noexcept(expr) should not be a possible result");
6152 return ComputedEST;
6153 }
6154
6155 /// The number of exceptions in the exception specification.
6156 unsigned size() const { return Exceptions.size(); }
6157
6158 /// The set of exceptions in the exception specification.
6159 const QualType *data() const { return Exceptions.data(); }
6160
6161 /// Integrate another called method into the collected data.
6162 void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method);
6163
6164 /// Integrate an invoked expression into the collected data.
6165 void CalledExpr(Expr *E) { CalledStmt(E); }
6166
6167 /// Integrate an invoked statement into the collected data.
6168 void CalledStmt(Stmt *S);
6169
6170 /// Overwrite an EPI's exception specification with this
6171 /// computed exception specification.
6174 ESI.Type = getExceptionSpecType();
6175 if (ESI.Type == EST_Dynamic) {
6176 ESI.Exceptions = Exceptions;
6177 } else if (ESI.Type == EST_None) {
6178 /// C++11 [except.spec]p14:
6179 /// The exception-specification is noexcept(false) if the set of
6180 /// potential exceptions of the special member function contains "any"
6181 ESI.Type = EST_NoexceptFalse;
6183 tok::kw_false).get();
6184 }
6185 return ESI;
6186 }
6187 };
6188
6189 /// Evaluate the implicit exception specification for a defaulted
6190 /// special member function.
6192
6193 /// Check the given noexcept-specifier, convert its expression, and compute
6194 /// the appropriate ExceptionSpecificationType.
6195 ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr,
6197
6198 /// Check the given exception-specification and update the
6199 /// exception specification information with the results.
6200 void checkExceptionSpecification(bool IsTopLevel,
6202 ArrayRef<ParsedType> DynamicExceptions,
6203 ArrayRef<SourceRange> DynamicExceptionRanges,
6204 Expr *NoexceptExpr,
6205 SmallVectorImpl<QualType> &Exceptions,
6207
6208 /// Determine if we're in a case where we need to (incorrectly) eagerly
6209 /// parse an exception specification to work around a libstdc++ bug.
6211
6212 /// Add an exception-specification to the given member function
6213 /// (or member function template). The exception-specification was parsed
6214 /// after the method itself was declared.
6217 SourceRange SpecificationRange,
6218 ArrayRef<ParsedType> DynamicExceptions,
6219 ArrayRef<SourceRange> DynamicExceptionRanges,
6220 Expr *NoexceptExpr);
6221
6222 class InheritedConstructorInfo;
6223
6224 /// Determine if a special member function should have a deleted
6225 /// definition when it is defaulted.
6226 bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM,
6227 InheritedConstructorInfo *ICI = nullptr,
6228 bool Diagnose = false);
6229
6230 /// Produce notes explaining why a defaulted function was defined as deleted.
6232
6233 /// Declare the implicit default constructor for the given class.
6234 ///
6235 /// \param ClassDecl The class declaration into which the implicit
6236 /// default constructor will be added.
6237 ///
6238 /// \returns The implicitly-declared default constructor.
6240 CXXRecordDecl *ClassDecl);
6241
6242 /// DefineImplicitDefaultConstructor - Checks for feasibility of
6243 /// defining this constructor as the default constructor.
6245 CXXConstructorDecl *Constructor);
6246
6247 /// Declare the implicit destructor for the given class.
6248 ///
6249 /// \param ClassDecl The class declaration into which the implicit
6250 /// destructor will be added.
6251 ///
6252 /// \returns The implicitly-declared destructor.
6254
6255 /// DefineImplicitDestructor - Checks for feasibility of
6256 /// defining this destructor as the default destructor.
6257 void DefineImplicitDestructor(SourceLocation CurrentLocation,
6258 CXXDestructorDecl *Destructor);
6259
6260 /// Build an exception spec for destructors that don't have one.
6261 ///
6262 /// C++11 says that user-defined destructors with no exception spec get one
6263 /// that looks as if the destructor was implicitly declared.
6265
6266 /// Define the specified inheriting constructor.
6268 CXXConstructorDecl *Constructor);
6269
6270 /// Declare the implicit copy constructor for the given class.
6271 ///
6272 /// \param ClassDecl The class declaration into which the implicit
6273 /// copy constructor will be added.
6274 ///
6275 /// \returns The implicitly-declared copy constructor.
6277
6278 /// DefineImplicitCopyConstructor - Checks for feasibility of
6279 /// defining this constructor as the copy constructor.
6280 void DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
6281 CXXConstructorDecl *Constructor);
6282
6283 /// Declare the implicit move constructor for the given class.
6284 ///
6285 /// \param ClassDecl The Class declaration into which the implicit
6286 /// move constructor will be added.
6287 ///
6288 /// \returns The implicitly-declared move constructor, or NULL if it wasn't
6289 /// declared.
6291
6292 /// DefineImplicitMoveConstructor - Checks for feasibility of
6293 /// defining this constructor as the move constructor.
6294 void DefineImplicitMoveConstructor(SourceLocation CurrentLocation,
6295 CXXConstructorDecl *Constructor);
6296
6297 /// Declare the implicit copy assignment operator for the given class.
6298 ///
6299 /// \param ClassDecl The class declaration into which the implicit
6300 /// copy assignment operator will be added.
6301 ///
6302 /// \returns The implicitly-declared copy assignment operator.
6304
6305 /// Defines an implicitly-declared copy assignment operator.
6306 void DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
6307 CXXMethodDecl *MethodDecl);
6308
6309 /// Declare the implicit move assignment operator for the given class.
6310 ///
6311 /// \param ClassDecl The Class declaration into which the implicit
6312 /// move assignment operator will be added.
6313 ///
6314 /// \returns The implicitly-declared move assignment operator, or NULL if it
6315 /// wasn't declared.
6317
6318 /// Defines an implicitly-declared move assignment operator.
6319 void DefineImplicitMoveAssignment(SourceLocation CurrentLocation,
6320 CXXMethodDecl *MethodDecl);
6321
6322 /// Force the declaration of any implicitly-declared members of this
6323 /// class.
6325
6326 /// Check a completed declaration of an implicit special member.
6328
6329 /// Determine whether the given function is an implicitly-deleted
6330 /// special member function.
6332
6333 /// Check whether 'this' shows up in the type of a static member
6334 /// function after the (naturally empty) cv-qualifier-seq would be.
6335 ///
6336 /// \returns true if an error occurred.
6338
6339 /// Whether this' shows up in the exception specification of a static
6340 /// member function.
6342
6343 /// Check whether 'this' shows up in the attributes of the given
6344 /// static member function.
6345 ///
6346 /// \returns true if an error occurred.
6348
6349 /// MaybeBindToTemporary - If the passed in expression has a record type with
6350 /// a non-trivial destructor, this will return CXXBindTemporaryExpr. Otherwise
6351 /// it simply returns the passed in expression.
6353
6354 /// Wrap the expression in a ConstantExpr if it is a potential immediate
6355 /// invocation.
6357
6359 QualType DeclInitType, MultiExprArg ArgsPtr,
6360 SourceLocation Loc,
6361 SmallVectorImpl<Expr *> &ConvertedArgs,
6362 bool AllowExplicit = false,
6363 bool IsListInitialization = false);
6364
6366 SourceLocation NameLoc,
6367 IdentifierInfo &Name);
6368
6370 Scope *S, CXXScopeSpec &SS,
6371 bool EnteringContext);
6373 IdentifierInfo &II, SourceLocation NameLoc,
6374 Scope *S, CXXScopeSpec &SS,
6375 ParsedType ObjectType,
6376 bool EnteringContext);
6377
6379 ParsedType ObjectType);
6380
6381 // Checks that reinterpret casts don't have undefined behavior.
6382 void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType,
6383 bool IsDereference, SourceRange Range);
6384
6385 // Checks that the vector type should be initialized from a scalar
6386 // by splatting the value rather than populating a single element.
6387 // This is the case for AltiVecVector types as well as with
6388 // AltiVecPixel and AltiVecBool when -faltivec-src-compat=xl is specified.
6389 bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy);
6390
6391 // Checks if the -faltivec-src-compat=gcc option is specified.
6392 // If so, AltiVecVector, AltiVecBool and AltiVecPixel types are
6393 // treated the same way as they are when trying to initialize
6394 // these vectors on gcc (an error is emitted).
6396 QualType SrcTy);
6397
6398 /// ActOnCXXNamedCast - Parse
6399 /// {dynamic,static,reinterpret,const,addrspace}_cast's.
6401 tok::TokenKind Kind,
6402 SourceLocation LAngleBracketLoc,
6403 Declarator &D,
6404 SourceLocation RAngleBracketLoc,
6405 SourceLocation LParenLoc,
6406 Expr *E,
6407 SourceLocation RParenLoc);
6408
6410 tok::TokenKind Kind,
6411 TypeSourceInfo *Ty,
6412 Expr *E,
6413 SourceRange AngleBrackets,
6414 SourceRange Parens);
6415
6417 ExprResult Operand,
6418 SourceLocation RParenLoc);
6419
6421 Expr *Operand, SourceLocation RParenLoc);
6422
6423 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6424 SourceLocation TypeidLoc,
6425 TypeSourceInfo *Operand,
6426 SourceLocation RParenLoc);
6427 ExprResult BuildCXXTypeId(QualType TypeInfoType,
6428 SourceLocation TypeidLoc,
6429 Expr *Operand,
6430 SourceLocation RParenLoc);
6431
6432 /// ActOnCXXTypeid - Parse typeid( something ).
6434 SourceLocation LParenLoc, bool isType,
6435 void *TyOrExpr,
6436 SourceLocation RParenLoc);
6437
6438 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6439 SourceLocation TypeidLoc,
6440 TypeSourceInfo *Operand,
6441 SourceLocation RParenLoc);
6442 ExprResult BuildCXXUuidof(QualType TypeInfoType,
6443 SourceLocation TypeidLoc,
6444 Expr *Operand,
6445 SourceLocation RParenLoc);
6446
6447 /// ActOnCXXUuidof - Parse __uuidof( something ).
6449 SourceLocation LParenLoc, bool isType,
6450 void *TyOrExpr,
6451 SourceLocation RParenLoc);
6452
6453 /// Handle a C++1z fold-expression: ( expr op ... op expr ).
6455 tok::TokenKind Operator,
6456 SourceLocation EllipsisLoc, Expr *RHS,
6457 SourceLocation RParenLoc);
6459 SourceLocation LParenLoc, Expr *LHS,
6460 BinaryOperatorKind Operator,
6461 SourceLocation EllipsisLoc, Expr *RHS,
6462 SourceLocation RParenLoc,
6463 Optional<unsigned> NumExpansions);
6465 BinaryOperatorKind Operator);
6466
6467 //// ActOnCXXThis - Parse 'this' pointer.
6469
6470 /// Build a CXXThisExpr and mark it referenced in the current context.
6471 Expr *BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit);
6472 void MarkThisReferenced(CXXThisExpr *This);
6473
6474 /// Try to retrieve the type of the 'this' pointer.
6475 ///
6476 /// \returns The type of 'this', if possible. Otherwise, returns a NULL type.
6478
6479 /// When non-NULL, the C++ 'this' expression is allowed despite the
6480 /// current context not being a non-static member function. In such cases,
6481 /// this provides the type used for 'this'.
6483
6484 /// RAII object used to temporarily allow the C++ 'this' expression
6485 /// to be used, with the given qualifiers on the current class type.
6487 Sema &S;
6488 QualType OldCXXThisTypeOverride;
6489 bool Enabled;
6490
6491 public:
6492 /// Introduce a new scope where 'this' may be allowed (when enabled),
6493 /// using the given declaration (which is either a class template or a
6494 /// class) along with the given qualifiers.
6495 /// along with the qualifiers placed on '*this'.
6496 CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals,
6497 bool Enabled = true);
6498
6500 };
6501
6502 /// Make sure the value of 'this' is actually available in the current
6503 /// context, if it is a potentially evaluated context.
6504 ///
6505 /// \param Loc The location at which the capture of 'this' occurs.
6506 ///
6507 /// \param Explicit Whether 'this' is explicitly captured in a lambda
6508 /// capture list.
6509 ///
6510 /// \param FunctionScopeIndexToStopAt If non-null, it points to the index
6511 /// of the FunctionScopeInfo stack beyond which we do not attempt to capture.
6512 /// This is useful when enclosing lambdas must speculatively capture
6513 /// 'this' that may or may not be used in certain specializations of
6514 /// a nested generic lambda (depending on whether the name resolves to
6515 /// a non-static member function or a static function).
6516 /// \return returns 'true' if failed, 'false' if success.
6517 bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit = false,
6518 bool BuildAndDiagnose = true,
6519 const unsigned *const FunctionScopeIndexToStopAt = nullptr,
6520 bool ByCopy = false);
6521
6522 /// Determine whether the given type is the type of *this that is used
6523 /// outside of the body of a member function for a type that is currently
6524 /// being defined.
6526
6527 /// ActOnCXXBoolLiteral - Parse {true,false} literals.
6529
6530
6531 /// ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
6533
6536 SourceLocation AtLoc, SourceLocation RParen);
6537
6538 /// ActOnCXXNullPtrLiteral - Parse 'nullptr'.
6540
6541 //// ActOnCXXThrow - Parse throw expressions.
6544 bool IsThrownVarInScope);
6545 bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E);
6546
6547 /// ActOnCXXTypeConstructExpr - Parse construction of a specified type.
6548 /// Can be interpreted either as function-style casting ("int(x)")
6549 /// or class type construction ("ClassType(x,y,z)")
6550 /// or creation of a value-initialized type ("int()").
6552 SourceLocation LParenOrBraceLoc,
6553 MultiExprArg Exprs,
6554 SourceLocation RParenOrBraceLoc,
6555 bool ListInitialization);
6556
6558 SourceLocation LParenLoc,
6559 MultiExprArg Exprs,
6560 SourceLocation RParenLoc,
6561 bool ListInitialization);
6562
6563 /// ActOnCXXNew - Parsed a C++ 'new' expression.
6564 ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
6565 SourceLocation PlacementLParen,
6566 MultiExprArg PlacementArgs,
6567 SourceLocation PlacementRParen,
6568 SourceRange TypeIdParens, Declarator &D,
6569 Expr *Initializer);
6570 ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal,
6571 SourceLocation PlacementLParen,
6572 MultiExprArg PlacementArgs,
6573 SourceLocation PlacementRParen,
6574 SourceRange TypeIdParens,
6575 QualType AllocType,
6576 TypeSourceInfo *AllocTypeInfo,
6577 Optional<Expr *> ArraySize,
6578 SourceRange DirectInitRange,
6579 Expr *Initializer);
6580
6581 /// Determine whether \p FD is an aligned allocation or deallocation
6582 /// function that is unavailable.
6584
6585 /// Produce diagnostics if \p FD is an aligned allocation or deallocation
6586 /// function that is unavailable.
6588 SourceLocation Loc);
6589
6590 bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
6591 SourceRange R);
6592
6593 /// The scope in which to find allocation functions.
6595 /// Only look for allocation functions in the global scope.
6597 /// Only look for allocation functions in the scope of the
6598 /// allocated class.
6600 /// Look for allocation functions in both the global scope
6601 /// and in the scope of the allocated class.
6602 AFS_Both
6604
6605 /// Finds the overloads of operator new and delete that are appropriate
6606 /// for the allocation.
6608 AllocationFunctionScope NewScope,
6609 AllocationFunctionScope DeleteScope,
6610 QualType AllocType, bool IsArray,
6611 bool &PassAlignment, MultiExprArg PlaceArgs,
6612 FunctionDecl *&OperatorNew,
6613 FunctionDecl *&OperatorDelete,
6614 bool Diagnose = true);
6617 ArrayRef<QualType> Params);
6618
6620 DeclarationName Name, FunctionDecl* &Operator,
6621 bool Diagnose = true);
6623 bool CanProvideSize,
6624 bool Overaligned,
6625 DeclarationName Name);
6627 CXXRecordDecl *RD);
6628
6629 /// ActOnCXXDelete - Parsed a C++ 'delete' expression
6631 bool UseGlobal, bool ArrayForm,
6632 Expr *Operand);
6634 bool IsDelete, bool CallCanBeVirtual,
6635 bool WarnOnNonAbstractTypes,
6636 SourceLocation DtorLoc);
6637
6639 Expr *Operand, SourceLocation RParen);
6641 SourceLocation RParen);
6642
6643 /// Parsed one of the type trait support pseudo-functions.
6646 SourceLocation RParenLoc);
6649 SourceLocation RParenLoc);
6650
6651 /// ActOnArrayTypeTrait - Parsed one of the binary type trait support
6652 /// pseudo-functions.
6654 SourceLocation KWLoc,
6655 ParsedType LhsTy,
6656 Expr *DimExpr,
6657 SourceLocation RParen);
6658
6660 SourceLocation KWLoc,
6661 TypeSourceInfo *TSInfo,
6662 Expr *DimExpr,
6663 SourceLocation RParen);
6664
6665 /// ActOnExpressionTrait - Parsed one of the unary type trait support
6666 /// pseudo-functions.
6668 SourceLocation KWLoc,
6669 Expr *Queried,
6670 SourceLocation RParen);
6671
6673 SourceLocation KWLoc,
6674 Expr *Queried,
6675 SourceLocation RParen);
6676
6678 Expr *Base,
6679 SourceLocation OpLoc,
6680 tok::TokenKind OpKind,
6681 ParsedType &ObjectType,
6682 bool &MayBePseudoDestructor);
6683
6685 SourceLocation OpLoc,
6686 tok::TokenKind OpKind,
6687 const CXXScopeSpec &SS,
6688 TypeSourceInfo *ScopeType,
6689 SourceLocation CCLoc,
6690 SourceLocation TildeLoc,
6691 PseudoDestructorTypeStorage DestroyedType);
6692
6694 SourceLocation OpLoc,
6695 tok::TokenKind OpKind,
6696 CXXScopeSpec &SS,
6697 UnqualifiedId &FirstTypeName,
6698 SourceLocation CCLoc,
6699 SourceLocation TildeLoc,
6700 UnqualifiedId &SecondTypeName);
6701
6703 SourceLocation OpLoc,
6704 tok::TokenKind OpKind,
6705 SourceLocation TildeLoc,
6706 const DeclSpec& DS);
6707
6708 /// MaybeCreateExprWithCleanups - If the current full-expression
6709 /// requires any cleanups, surround it with a ExprWithCleanups node.
6710 /// Otherwise, just returns the passed-in expression.
6714
6717 bool BoundToLvalueReference);
6718
6719 ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue) {
6720 return ActOnFinishFullExpr(
6721 Expr, Expr ? Expr->getExprLoc() : SourceLocation(), DiscardedValue);
6722 }
6724 bool DiscardedValue, bool IsConstexpr = false);
6726
6727 // Marks SS invalid if it represents an incomplete type.
6729 // Complete an enum decl, maybe without a scope spec.
6731 CXXScopeSpec *SS = nullptr);
6732
6735 bool EnteringContext = false);
6738
6739 /// The parser has parsed a global nested-name-specifier '::'.
6740 ///
6741 /// \param CCLoc The location of the '::'.
6742 ///
6743 /// \param SS The nested-name-specifier, which will be updated in-place
6744 /// to reflect the parsed nested-name-specifier.
6745 ///
6746 /// \returns true if an error occurred, false otherwise.
6748
6749 /// The parser has parsed a '__super' nested-name-specifier.
6750 ///
6751 /// \param SuperLoc The location of the '__super' keyword.
6752 ///
6753 /// \param ColonColonLoc The location of the '::'.
6754 ///
6755 /// \param SS The nested-name-specifier, which will be updated in-place
6756 /// to reflect the parsed nested-name-specifier.
6757 ///
6758 /// \returns true if an error occurred, false otherwise.
6760 SourceLocation ColonColonLoc, CXXScopeSpec &SS);
6761
6763 bool *CanCorrect = nullptr);
6765
6766 /// Keeps information about an identifier in a nested-name-spec.
6767 ///
6769 /// The type of the object, if we're parsing nested-name-specifier in
6770 /// a member access expression.
6772
6773 /// The identifier preceding the '::'.
6775
6776 /// The location of the identifier.
6778
6779 /// The location of the '::'.
6781
6782 /// Creates info object for the most typical case.
6786 CCLoc(ColonColonLoc) {
6787 }
6788
6790 SourceLocation ColonColonLoc, QualType ObjectType)
6792 IdentifierLoc(IdLoc), CCLoc(ColonColonLoc) {
6793 }
6794 };
6795
6797 NestedNameSpecInfo &IdInfo);
6798
6800 NestedNameSpecInfo &IdInfo,
6801 bool EnteringContext,
6802 CXXScopeSpec &SS,
6803 NamedDecl *ScopeLookupResult,
6804 bool ErrorRecoveryLookup,
6805 bool *IsCorrectedToColon = nullptr,
6806 bool OnlyNamespace = false);
6807
6808 /// The parser has parsed a nested-name-specifier 'identifier::'.
6809 ///
6810 /// \param S The scope in which this nested-name-specifier occurs.
6811 ///
6812 /// \param IdInfo Parser information about an identifier in the
6813 /// nested-name-spec.
6814 ///
6815 /// \param EnteringContext Whether we're entering the context nominated by
6816 /// this nested-name-specifier.
6817 ///
6818 /// \param SS The nested-name-specifier, which is both an input
6819 /// parameter (the nested-name-specifier before this type) and an
6820 /// output parameter (containing the full nested-name-specifier,
6821 /// including this new type).
6822 ///
6823 /// \param ErrorRecoveryLookup If true, then this method is called to improve
6824 /// error recovery. In this case do not emit error message.
6825 ///
6826 /// \param IsCorrectedToColon If not null, suggestions to replace '::' -> ':'
6827 /// are allowed. The bool value pointed by this parameter is set to 'true'
6828 /// if the identifier is treated as if it was followed by ':', not '::'.
6829 ///
6830 /// \param OnlyNamespace If true, only considers namespaces in lookup.
6831 ///
6832 /// \returns true if an error occurred, false otherwise.
6834 NestedNameSpecInfo &IdInfo,
6835 bool EnteringContext,
6836 CXXScopeSpec &SS,
6837 bool *IsCorrectedToColon = nullptr,
6838 bool OnlyNamespace = false);
6839
6841
6843 const DeclSpec &DS,
6844 SourceLocation ColonColonLoc);
6845
6847 NestedNameSpecInfo &IdInfo,
6848 bool EnteringContext);
6849
6850 /// The parser has parsed a nested-name-specifier
6851 /// 'template[opt] template-name < template-args >::'.
6852 ///
6853 /// \param S The scope in which this nested-name-specifier occurs.
6854 ///
6855 /// \param SS The nested-name-specifier, which is both an input
6856 /// parameter (the nested-name-specifier before this type) and an
6857 /// output parameter (containing the full nested-name-specifier,
6858 /// including this new type).
6859 ///
6860 /// \param TemplateKWLoc the location of the 'template' keyword, if any.
6861 /// \param TemplateName the template name.
6862 /// \param TemplateNameLoc The location of the template name.
6863 /// \param LAngleLoc The location of the opening angle bracket ('<').
6864 /// \param TemplateArgs The template arguments.
6865 /// \param RAngleLoc The location of the closing angle bracket ('>').
6866 /// \param CCLoc The location of the '::'.
6867 ///
6868 /// \param EnteringContext Whether we're entering the context of the
6869 /// nested-name-specifier.
6870 ///
6871 ///
6872 /// \returns true if an error occurred, false otherwise.
6874 CXXScopeSpec &SS,
6875 SourceLocation TemplateKWLoc,
6877 SourceLocation TemplateNameLoc,
6878 SourceLocation LAngleLoc,
6879 ASTTemplateArgsPtr TemplateArgs,
6880 SourceLocation RAngleLoc,
6881 SourceLocation CCLoc,
6882 bool EnteringContext);
6883
6884 /// Given a C++ nested-name-specifier, produce an annotation value
6885 /// that the parser can use later to reconstruct the given
6886 /// nested-name-specifier.
6887 ///
6888 /// \param SS A nested-name-specifier.
6889 ///
6890 /// \returns A pointer containing all of the information in the
6891 /// nested-name-specifier \p SS.
6893
6894 /// Given an annotation pointer for a nested-name-specifier, restore
6895 /// the nested-name-specifier structure.
6896 ///
6897 /// \param Annotation The annotation pointer, produced by
6898 /// \c SaveNestedNameSpecifierAnnotation().
6899 ///
6900 /// \param AnnotationRange The source range corresponding to the annotation.
6901 ///
6902 /// \param SS The nested-name-specifier that will be updated with the contents
6903 /// of the annotation pointer.
6904 void RestoreNestedNameSpecifierAnnotation(void *Annotation,
6905 SourceRange AnnotationRange,
6906 CXXScopeSpec &SS);
6907
6908 bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS);
6909
6910 /// ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global
6911 /// scope or nested-name-specifier) is parsed, part of a declarator-id.
6912 /// After this method is called, according to [C++ 3.4.3p3], names should be
6913 /// looked up in the declarator-id's scope, until the declarator is parsed and
6914 /// ActOnCXXExitDeclaratorScope is called.
6915 /// The 'SS' should be a non-empty valid CXXScopeSpec.
6917
6918 /// ActOnCXXExitDeclaratorScope - Called when a declarator that previously
6919 /// invoked ActOnCXXEnterDeclaratorScope(), is finished. 'SS' is the same
6920 /// CXXScopeSpec that was passed to ActOnCXXEnterDeclaratorScope as well.
6921 /// Used to indicate that names should revert to being looked up in the
6922 /// defining scope.
6924
6925 /// ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an
6926 /// initializer for the declaration 'Dcl'.
6927 /// After this method is called, according to [C++ 3.4.1p13], if 'Dcl' is a
6928 /// static data member of class X, names should be looked up in the scope of
6929 /// class X.
6931
6932 /// ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an
6933 /// initializer for the declaration 'Dcl'.
6934 void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl);
6935
6936 /// Create a new lambda closure type.
6938 TypeSourceInfo *Info,
6939 unsigned LambdaDependencyKind,
6940 LambdaCaptureDefault CaptureDefault);
6941
6942 /// Start the definition of a lambda expression.
6944 SourceRange IntroducerRange,
6945 TypeSourceInfo *MethodType,
6946 SourceLocation EndLoc,
6948 ConstexprSpecKind ConstexprKind,
6949 Expr *TrailingRequiresClause);
6950
6951 /// Number lambda for linkage purposes if necessary.
6953 CXXRecordDecl *Class, CXXMethodDecl *Method,
6954 Optional<std::tuple<bool, unsigned, unsigned, Decl *>> Mangling = None);
6955
6956 /// Endow the lambda scope info with the relevant properties.
6958 CXXMethodDecl *CallOperator,
6959 SourceRange IntroducerRange,
6960 LambdaCaptureDefault CaptureDefault,
6961 SourceLocation CaptureDefaultLoc,
6962 bool ExplicitParams,
6963 bool ExplicitResultType,
6964 bool Mutable);
6965
6966 /// Perform initialization analysis of the init-capture and perform
6967 /// any implicit conversions such as an lvalue-to-rvalue conversion if
6968 /// not being used to initialize a reference.
6970 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
6971 IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init) {
6973 Loc, ByRef, EllipsisLoc, None, Id,
6974 InitKind != LambdaCaptureInitKind::CopyInit, Init));
6975 }
6977 SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc,
6978 Optional<unsigned> NumExpansions, IdentifierInfo *Id, bool DirectInit,
6979 Expr *&Init);
6980
6981 /// Create a dummy variable within the declcontext of the lambda's
6982 /// call operator, for name lookup purposes for a lambda init capture.
6983 ///
6984 /// CodeGen handles emission of lambda captures, ignoring these dummy
6985 /// variables appropriately.
6987 QualType InitCaptureType,
6988 SourceLocation EllipsisLoc,
6990 unsigned InitStyle, Expr *Init);
6991
6992 /// Add an init-capture to a lambda scope.
6994
6995 /// Note that we have finished the explicit captures for the
6996 /// given lambda.
6998
6999 /// \brief This is called after parsing the explicit template parameter list
7000 /// on a lambda (if it exists) in C++2a.
7002 ArrayRef<NamedDecl *> TParams,
7003 SourceLocation RAngleLoc,
7004 ExprResult RequiresClause);
7005
7006 /// Introduce the lambda parameters into scope.
7009 CXXMethodDecl *CallOperator, Scope *CurScope);
7010
7011 /// Deduce a block or lambda's return type based on the return
7012 /// statements present in the body.
7014
7015 /// ActOnStartOfLambdaDefinition - This is called just before we start
7016 /// parsing the body of a lambda; it analyzes the explicit captures and
7017 /// arguments, and sets up various data-structures for the body of the
7018 /// lambda.
7020 Declarator &ParamInfo, Scope *CurScope);
7021
7022 /// ActOnLambdaError - If there is an error parsing a lambda, this callback
7023 /// is invoked to pop the information about the lambda.
7024 void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope,
7025 bool IsInstantiation = false);
7026
7027 /// ActOnLambdaExpr - This is called when the body of a lambda expression
7028 /// was successfully completed.
7030 Scope *CurScope);
7031
7032 /// Does copying/destroying the captured variable have side effects?
7033 bool CaptureHasSideEffects(const sema::Capture &From);
7034
7035 /// Diagnose if an explicit lambda capture is unused. Returns true if a
7036 /// diagnostic is emitted.
7037 bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange,
7038 const sema::Capture &From);
7039
7040 /// Build a FieldDecl suitable to hold the given capture.
7042
7043 /// Initialize the given capture with a suitable expression.
7045 SourceLocation ImplicitCaptureLoc,
7046 bool IsOpenMPMapping = false);
7047
7048 /// Complete a lambda-expression having processed and attached the
7049 /// lambda body.
7052
7053 /// Get the return type to use for a lambda's conversion function(s) to
7054 /// function pointer type, given the type of the call operator.
7055 QualType
7057 CallingConv CC);
7058
7059 /// Define the "body" of the conversion from a lambda object to a
7060 /// function pointer.
7061 ///
7062 /// This routine doesn't actually define a sensible body; rather, it fills
7063 /// in the initialization expression needed to copy the lambda object into
7064 /// the block, and IR generation actually generates the real body of the
7065 /// block pointer conversion.
7067 SourceLocation CurrentLoc, CXXConversionDecl *Conv);
7068
7069 /// Define the "body" of the conversion from a lambda object to a
7070 /// block pointer.
7071 ///
7072 /// This routine doesn't actually define a sensible body; rather, it fills
7073 /// in the initialization expression needed to copy the lambda object into
7074 /// the block, and IR generation actually generates the real body of the
7075 /// block pointer conversion.
7077 CXXConversionDecl *Conv);
7078
7080 SourceLocation ConvLocation,
7081 CXXConversionDecl *Conv,
7082 Expr *Src);
7083
7084 /// Check whether the given expression is a valid constraint expression.
7085 /// A diagnostic is emitted if it is not, false is returned, and
7086 /// PossibleNonPrimary will be set to true if the failure might be due to a
7087 /// non-primary expression being used as an atomic constraint.
7088 bool CheckConstraintExpression(const Expr *CE, Token NextToken = Token(),
7089 bool *PossibleNonPrimary = nullptr,
7090 bool IsTrailingRequiresClause = false);
7091
7092private:
7093 /// Caches pairs of template-like decls whose associated constraints were
7094 /// checked for subsumption and whether or not the first's constraints did in
7095 /// fact subsume the second's.
7096 llvm::DenseMap<std::pair<NamedDecl *, NamedDecl *>, bool> SubsumptionCache;
7097 /// Caches the normalized associated constraints of declarations (concepts or
7098 /// constrained declarations). If an error occurred while normalizing the
7099 /// associated constraints of the template or concept, nullptr will be cached
7100 /// here.
7101 llvm::DenseMap<NamedDecl *, NormalizedConstraint *>
7102 NormalizationCache;
7103
7104 llvm::ContextualFoldingSet<ConstraintSatisfaction, const ASTContext &>
7105 SatisfactionCache;
7106
7107 /// Introduce the instantiated function parameters into the local
7108 /// instantiation scope, and set the parameter names to those used
7109 /// in the template.
7110 bool addInstantiatedParametersToScope(
7111 FunctionDecl *Function, const FunctionDecl *PatternDecl,
7113 const MultiLevelTemplateArgumentList &TemplateArgs);
7114
7115public:
7116 const NormalizedConstraint *
7118 NamedDecl *ConstrainedDecl, ArrayRef<const Expr *> AssociatedConstraints);
7119
7120 /// \brief Check whether the given declaration's associated constraints are
7121 /// at least as constrained than another declaration's according to the
7122 /// partial ordering of constraints.
7123 ///
7124 /// \param Result If no error occurred, receives the result of true if D1 is
7125 /// at least constrained than D2, and false otherwise.
7126 ///
7127 /// \returns true if an error occurred, false otherwise.
7130 bool &Result);
7131
7132 /// If D1 was not at least as constrained as D2, but would've been if a pair
7133 /// of atomic constraints involved had been declared in a concept and not
7134 /// repeated in two separate places in code.
7135 /// \returns true if such a diagnostic was emitted, false otherwise.
7138
7139 /// \brief Check whether the given list of constraint expressions are
7140 /// satisfied (as if in a 'conjunction') given template arguments.
7141 /// \param Template the template-like entity that triggered the constraints
7142 /// check (either a concept or a constrained entity).
7143 /// \param ConstraintExprs a list of constraint expressions, treated as if
7144 /// they were 'AND'ed together.
7145 /// \param TemplateArgs the list of template arguments to substitute into the
7146 /// constraint expression.
7147 /// \param TemplateIDRange The source range of the template id that
7148 /// caused the constraints check.
7149 /// \param Satisfaction if true is returned, will contain details of the
7150 /// satisfaction, with enough information to diagnose an unsatisfied
7151 /// expression.
7152 /// \returns true if an error occurred and satisfaction could not be checked,
7153 /// false otherwise.
7155 const NamedDecl *Template, ArrayRef<const Expr *> ConstraintExprs,
7156 ArrayRef<TemplateArgument> TemplateArgs,
7157 SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction);
7158
7159 /// \brief Check whether the given non-dependent constraint expression is
7160 /// satisfied. Returns false and updates Satisfaction with the satisfaction
7161 /// verdict if successful, emits a diagnostic and returns true if an error
7162 /// occurred and satisfaction could not be determined.
7163 ///
7164 /// \returns true if an error occurred, false otherwise.
7165 bool CheckConstraintSatisfaction(const Expr *ConstraintExpr,
7166 ConstraintSatisfaction &Satisfaction);
7167
7168 /// Check whether the given function decl's trailing requires clause is
7169 /// satisfied, if any. Returns false and updates Satisfaction with the
7170 /// satisfaction verdict if successful, emits a diagnostic and returns true if
7171 /// an error occurred and satisfaction could not be determined.
7172 ///
7173 /// \returns true if an error occurred, false otherwise.
7175 ConstraintSatisfaction &Satisfaction,
7176 SourceLocation UsageLoc = SourceLocation());
7177
7178
7179 /// \brief Ensure that the given template arguments satisfy the constraints
7180 /// associated with the given template, emitting a diagnostic if they do not.
7181 ///
7182 /// \param Template The template to which the template arguments are being
7183 /// provided.
7184 ///
7185 /// \param TemplateArgs The converted, canonicalized template arguments.
7186 ///
7187 /// \param TemplateIDRange The source range of the template id that
7188 /// caused the constraints check.
7189 ///
7190 /// \returns true if the constrains are not satisfied or could not be checked
7191 /// for satisfaction, false if the constraints are satisfied.
7193 ArrayRef<TemplateArgument> TemplateArgs,
7194 SourceRange TemplateIDRange);
7195
7196 /// \brief Emit diagnostics explaining why a constraint expression was deemed
7197 /// unsatisfied.
7198 /// \param First whether this is the first time an unsatisfied constraint is
7199 /// diagnosed for this error.
7200 void
7202 bool First = true);
7203
7204 /// \brief Emit diagnostics explaining why a constraint expression was deemed
7205 /// unsatisfied.
7206 void
7208 bool First = true);
7209
7210 // ParseObjCStringLiteral - Parse Objective-C string literals.
7212 ArrayRef<Expr *> Strings);
7213
7215
7216 /// BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the
7217 /// numeric literal expression. Type of the expression will be "NSNumber *"
7218 /// or "id" if NSNumber is unavailable.
7221 bool Value);
7223
7224 /// BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the
7225 /// '@' prefixed parenthesized expression. The type of the expression will
7226 /// either be "NSNumber *", "NSString *" or "NSValue *" depending on the type
7227 /// of ValueType, which is allowed to be a built-in numeric type, "char *",
7228 /// "const char *" or C structure with attribute 'objc_boxable'.
7230
7232 Expr *IndexExpr,
7233 ObjCMethodDecl *getterMethod,
7234 ObjCMethodDecl *setterMethod);
7235
7238
7240 TypeSourceInfo *EncodedTypeInfo,
7241 SourceLocation RParenLoc);
7243 CXXConversionDecl *Method,
7244 bool HadMultipleCandidates);
7245
7247 SourceLocation EncodeLoc,
7248 SourceLocation LParenLoc,
7249 ParsedType Ty,
7250 SourceLocation RParenLoc);
7251
7252 /// ParseObjCSelectorExpression - Build selector expression for \@selector
7254 SourceLocation AtLoc,
7255 SourceLocation SelLoc,
7256 SourceLocation LParenLoc,
7257 SourceLocation RParenLoc,
7258 bool WarnMultipleSelectors);
7259
7260 /// ParseObjCProtocolExpression - Build protocol expression for \@protocol
7262 SourceLocation AtLoc,
7263 SourceLocation ProtoLoc,
7264 SourceLocation LParenLoc,
7265 SourceLocation ProtoIdLoc,
7266 SourceLocation RParenLoc);
7267
7268 //===--------------------------------------------------------------------===//
7269 // C++ Declarations
7270 //
7272 SourceLocation ExternLoc,
7273 Expr *LangStr,
7274 SourceLocation LBraceLoc);
7276 Decl *LinkageSpec,
7277 SourceLocation RBraceLoc);
7278
7279
7280 //===--------------------------------------------------------------------===//
7281 // C++ Classes
7282 //
7284 bool isCurrentClassName(const IdentifierInfo &II, Scope *S,
7285 const CXXScopeSpec *SS = nullptr);
7287
7289 SourceLocation ColonLoc,
7290 const ParsedAttributesView &Attrs);
7291
7293 Declarator &D,
7294 MultiTemplateParamsArg TemplateParameterLists,
7295 Expr *BitfieldWidth, const VirtSpecifiers &VS,
7296 InClassInitStyle InitStyle);
7297
7300 SourceLocation EqualLoc,
7301 Expr *Init);
7302
7304 Scope *S,
7305 CXXScopeSpec &SS,
7306 IdentifierInfo *MemberOrBase,
7307 ParsedType TemplateTypeTy,
7308 const DeclSpec &DS,
7309 SourceLocation IdLoc,
7310 SourceLocation LParenLoc,
7311 ArrayRef<Expr *> Args,
7312 SourceLocation RParenLoc,
7313 SourceLocation EllipsisLoc);
7314
7316 Scope *S,
7317 CXXScopeSpec &SS,
7318 IdentifierInfo *MemberOrBase,
7319 ParsedType TemplateTypeTy,
7320 const DeclSpec &DS,
7321 SourceLocation IdLoc,
7322 Expr *InitList,
7323 SourceLocation EllipsisLoc);
7324
7326 Scope *S,
7327 CXXScopeSpec &SS,
7328 IdentifierInfo *MemberOrBase,
7329 ParsedType TemplateTypeTy,
7330 const DeclSpec &DS,
7331 SourceLocation IdLoc,
7332 Expr *Init,
7333 SourceLocation EllipsisLoc);
7334
7336 Expr *Init,
7337 SourceLocation IdLoc);
7338
7340 TypeSourceInfo *BaseTInfo,
7341 Expr *Init,
7342 CXXRecordDecl *ClassDecl,
7343 SourceLocation EllipsisLoc);
7344
7346 Expr *Init,
7347 CXXRecordDecl *ClassDecl);
7348
7351
7352 bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors,
7353 ArrayRef<CXXCtorInitializer *> Initializers = None);
7354
7355 void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation);
7356
7357
7358 /// MarkBaseAndMemberDestructorsReferenced - Given a record decl,
7359 /// mark all the non-trivial destructors of its members and bases as
7360 /// referenced.
7362 CXXRecordDecl *Record);
7363
7364 /// Mark destructors of virtual bases of this class referenced. In the Itanium
7365 /// C++ ABI, this is done when emitting a destructor for any non-abstract
7366 /// class. In the Microsoft C++ ABI, this is done any time a class's
7367 /// destructor is referenced.
7369 SourceLocation Location, CXXRecordDecl *ClassDecl,
7370 llvm::SmallPtrSetImpl<const RecordType *> *DirectVirtualBases = nullptr);
7371
7372 /// Do semantic checks to allow the complete destructor variant to be emitted
7373 /// when the destructor is defined in another translation unit. In the Itanium
7374 /// C++ ABI, destructor variants are emitted together. In the MS C++ ABI, they
7375 /// can be emitted in separate TUs. To emit the complete variant, run a subset
7376 /// of the checks performed when emitting a regular destructor.
7378 CXXDestructorDecl *Dtor);
7379
7380 /// The list of classes whose vtables have been used within
7381 /// this translation unit, and the source locations at which the
7382 /// first use occurred.
7383 typedef std::pair<CXXRecordDecl*, SourceLocation> VTableUse;
7384
7385 /// The list of vtables that are required but have not yet been
7386 /// materialized.
7388
7389 /// The set of classes whose vtables have been used within
7390 /// this translation unit, and a bit that will be true if the vtable is
7391 /// required to be emitted (otherwise, it should be emitted only if needed
7392 /// by code generation).
7393 llvm::DenseMap<CXXRecordDecl *, bool> VTablesUsed;
7394
7395 /// Load any externally-stored vtable uses.
7397
7398 /// Note that the vtable for the given class was used at the
7399 /// given location.
7401 bool DefinitionRequired = false);
7402
7403 /// Mark the exception specifications of all virtual member functions
7404 /// in the given class as needed.
7406 const CXXRecordDecl *RD);
7407
7408 /// MarkVirtualMembersReferenced - Will mark all members of the given
7409 /// CXXRecordDecl referenced.
7411 bool ConstexprOnly = false);
7412
7413 /// Define all of the vtables that have been used in this
7414 /// translation unit and reference any virtual members used by those
7415 /// vtables.
7416 ///
7417 /// \returns true if any work was done, false otherwise.
7418 bool DefineUsedVTables();
7419
7421
7422 void ActOnMemInitializers(Decl *ConstructorDecl,
7423 SourceLocation ColonLoc,
7425 bool AnyErrors);
7426
7427 /// Check class-level dllimport/dllexport attribute. The caller must
7428 /// ensure that referenceDLLExportedClassMethods is called some point later
7429 /// when all outer classes of Class are complete.
7432
7434
7436 CXXRecordDecl *Class, Attr *ClassAttr,
7437 ClassTemplateSpecializationDecl *BaseTemplateSpec,
7438 SourceLocation BaseLoc);
7439
7440 /// Add gsl::Pointer attribute to std::container::iterator
7441 /// \param ND The declaration that introduces the name
7442 /// std::container::iterator. \param UnderlyingRecord The record named by ND.
7443 void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord);
7444
7445 /// Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
7447
7448 /// Add [[gsl::Pointer]] attributes for std:: types.
7450
7451 void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record);
7452
7453 /// Check that the C++ class annoated with "trivial_abi" satisfies all the
7454 /// conditions that are needed for the attribute to have an effect.
7456
7458 Decl *TagDecl, SourceLocation LBrac,
7459 SourceLocation RBrac,
7460 const ParsedAttributesView &AttrList);
7463
7465 unsigned ActOnReenterTemplateScope(Decl *Template,
7466 llvm::function_ref<Scope *()> EnterScope);
7469 void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param);
7474 CachedTokens &Toks);
7477
7479 Expr *AssertExpr,
7480 Expr *AssertMessageExpr,
7481 SourceLocation RParenLoc);
7483 Expr *AssertExpr,
7484 StringLiteral *AssertMessageExpr,
7485 SourceLocation RParenLoc,
7486 bool Failed);
7487
7489 SourceLocation FriendLoc,
7490 TypeSourceInfo *TSInfo);
7491 Decl *ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS,
7492 MultiTemplateParamsArg TemplateParams);
7494 MultiTemplateParamsArg TemplateParams);
7495
7497 StorageClass& SC);
7498 void CheckConstructor(CXXConstructorDecl *Constructor);
7500 StorageClass& SC);
7501 bool CheckDestructor(CXXDestructorDecl *Destructor);
7503 StorageClass& SC);
7506 StorageClass &SC);
7508
7510
7512 CXXSpecialMember CSM);
7514
7518 FunctionDecl *Spaceship);
7521
7522 //===--------------------------------------------------------------------===//
7523 // C++ Derived Classes
7524 //
7525
7526 /// ActOnBaseSpecifier - Parsed a base specifier
7528 SourceRange SpecifierRange,
7529 bool Virtual, AccessSpecifier Access,
7530 TypeSourceInfo *TInfo,
7531 SourceLocation EllipsisLoc);
7532
7533 BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange,
7534 const ParsedAttributesView &Attrs, bool Virtual,
7535 AccessSpecifier Access, ParsedType basetype,
7536 SourceLocation BaseLoc,
7537 SourceLocation EllipsisLoc);
7538
7541 void ActOnBaseSpecifiers(Decl *ClassDecl,
7543
7546 CXXBasePaths &Paths);
7547
7548 // FIXME: I don't like this name.
7549 void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath);
7550
7552 SourceLocation Loc, SourceRange Range,
7553 CXXCastPath *BasePath = nullptr,
7554 bool IgnoreAccess = false);
7556 unsigned InaccessibleBaseID,
7557 unsigned AmbiguousBaseConvID,
7558 SourceLocation Loc, SourceRange Range,
7559 DeclarationName Name,
7560 CXXCastPath *BasePath,
7561 bool IgnoreAccess = false);
7562
7563 std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths);
7564
7566 const CXXMethodDecl *Old);
7567
7568 /// CheckOverridingFunctionReturnType - Checks whether the return types are
7569 /// covariant, according to C++ [class.virtual]p5.
7571 const CXXMethodDecl *Old);
7572
7573 /// CheckOverridingFunctionExceptionSpec - Checks whether the exception
7574 /// spec is a subset of base spec.
7576 const CXXMethodDecl *Old);
7577
7578 bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange);
7579
7580 /// CheckOverrideControl - Check C++11 override control semantics.
7582
7583 /// DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was
7584 /// not used in the declaration of an overriding method.
7585 void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent);
7586
7587 /// CheckForFunctionMarkedFinal - Checks whether a virtual member function
7588 /// overrides a virtual member function marked 'final', according to
7589 /// C++11 [class.virtual]p4.
7591 const CXXMethodDecl *Old);
7592
7593
7594 //===--------------------------------------------------------------------===//
7595 // C++ Access Control
7596 //
7597
7604
7605 bool SetMemberAccessSpecifier(NamedDecl *MemberDecl,
7606 NamedDecl *PrevMemberDecl,
7607 AccessSpecifier LexicalAS);
7608
7610 DeclAccessPair FoundDecl);
7612 DeclAccessPair FoundDecl);
7614 SourceRange PlacementRange,
7615 CXXRecordDecl *NamingClass,
7616 DeclAccessPair FoundDecl,
7617 bool Diagnose = true);
7620 DeclAccessPair FoundDecl,
7621 const InitializedEntity &Entity,
7622 bool IsCopyBindingRefToTemp = false);
7625 DeclAccessPair FoundDecl,
7626 const InitializedEntity &Entity,
7627 const PartialDiagnostic &PDiag);
7629 CXXDestructorDecl *Dtor,
7630 const PartialDiagnostic &PDiag,
7631 QualType objectType = QualType());
7634 CXXRecordDecl *NamingClass,
7635 DeclAccessPair Found);
7638 CXXRecordDecl *DecomposedClass,
7639 DeclAccessPair Field);
7641 const SourceRange &,
7642 DeclAccessPair FoundDecl);
7644 Expr *ObjectExpr,
7645 Expr *ArgExpr,
7646 DeclAccessPair FoundDecl);
7648 ArrayRef<Expr *> ArgExprs,
7649 DeclAccessPair FoundDecl);
7651 DeclAccessPair FoundDecl);
7653 QualType Base, QualType Derived,
7654 const CXXBasePath &Path,
7655 unsigned DiagID,
7656 bool ForceCheck = false,
7657 bool ForceUnprivileged = false);
7658 void CheckLookupAccess(const LookupResult &R);
7659 bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass,
7660 QualType BaseType);
7662 DeclAccessPair Found, QualType ObjectType,
7663 SourceLocation Loc,
7664 const PartialDiagnostic &Diag);
7666 DeclAccessPair Found,
7667 QualType ObjectType) {
7668 return isMemberAccessibleForDeletion(NamingClass, Found, ObjectType,
7669 SourceLocation(), PDiag());
7670 }
7671
7673 const MultiLevelTemplateArgumentList &TemplateArgs);
7674 void PerformDependentDiagnostics(const DeclContext *Pattern,
7675 const MultiLevelTemplateArgumentList &TemplateArgs);
7676
7678
7679 /// When true, access checking violations are treated as SFINAE
7680 /// failures rather than hard errors.
7682
7693
7696 TypeDiagnoser &Diagnoser);
7697 template <typename... Ts>
7698 bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID,
7699 const Ts &...Args) {
7700 BoundTypeDiagnoser<Ts...> Diagnoser(DiagID, Args...);
7701 return RequireNonAbstractType(Loc, T, Diagnoser);
7702 }
7703
7704 void DiagnoseAbstractType(const CXXRecordDecl *RD);
7705
7706 //===--------------------------------------------------------------------===//
7707 // C++ Overloaded Operators [C++ 13.5]
7708 //
7709
7711
7713
7714 //===--------------------------------------------------------------------===//
7715 // C++ Templates [C++ 14]
7716 //
7718 bool AllowFunctionTemplates = true,
7719 bool AllowDependent = true);
7721 bool AllowFunctionTemplates = true,
7722 bool AllowDependent = true,
7723 bool AllowNonTemplateFunctions = false);
7724 /// Try to interpret the lookup result D as a template-name.
7725 ///
7726 /// \param D A declaration found by name lookup.
7727 /// \param AllowFunctionTemplates Whether function templates should be
7728 /// considered valid results.
7729 /// \param AllowDependent Whether unresolved using declarations (that might
7730 /// name templates) should be considered valid results.
7732 bool AllowFunctionTemplates = true,
7733 bool AllowDependent = true);
7734
7736 /// Whether and why a template name is required in this lookup.
7738 public:
7739 /// Template name is required if TemplateKWLoc is valid.
7741 : TemplateKW(TemplateKWLoc) {}
7742 /// Template name is unconditionally required.
7744
7746 return TemplateKW.value_or(SourceLocation());
7747 }
7749 bool isRequired() const { return TemplateKW != SourceLocation(); }
7750 explicit operator bool() const { return isRequired(); }
7751
7752 private:
7754 };
7755
7757 /// This is not assumed to be a template name.
7758 None,
7759 /// This is assumed to be a template name because lookup found nothing.
7761 /// This is assumed to be a template name because lookup found one or more
7762 /// functions (but no function templates).
7764 };
7765 bool LookupTemplateName(
7766 LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType,
7767 bool EnteringContext, bool &MemberOfUnknownSpecialization,
7768 RequiredTemplateKind RequiredTemplate = SourceLocation(),
7769 AssumedTemplateKind *ATK = nullptr, bool AllowTypoCorrection = true);
7770
7772 CXXScopeSpec &SS,
7773 bool hasTemplateKeyword,
7774 const UnqualifiedId &Name,
7775 ParsedType ObjectType,
7776 bool EnteringContext,
7777 TemplateTy &Template,
7778 bool &MemberOfUnknownSpecialization,
7779 bool Disambiguation = false);
7780
7781 /// Try to resolve an undeclared template name as a type template.
7782 ///
7783 /// Sets II to the identifier corresponding to the template name, and updates
7784 /// Name to a corresponding (typo-corrected) type template name and TNK to
7785 /// the corresponding kind, if possible.
7787 TemplateNameKind &TNK,
7788 SourceLocation NameLoc,
7789 IdentifierInfo *&II);
7790
7792 SourceLocation NameLoc,
7793 bool Diagnose = true);
7794
7795 /// Determine whether a particular identifier might be the name in a C++1z
7796 /// deduction-guide declaration.
7797 bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name,
7798 SourceLocation NameLoc,
7799 ParsedTemplateTy *Template = nullptr);
7800
7802 SourceLocation IILoc,
7803 Scope *S,
7804 const CXXScopeSpec *SS,
7805 TemplateTy &SuggestedTemplate,
7806 TemplateNameKind &SuggestedKind);
7807
7808 bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation,
7809 NamedDecl *Instantiation,
7810 bool InstantiatedFromMember,
7811 const NamedDecl *Pattern,
7812 const NamedDecl *PatternDef,
7814 bool Complain = true);
7815
7818
7819 NamedDecl *ActOnTypeParameter(Scope *S, bool Typename,
7820 SourceLocation EllipsisLoc,
7821 SourceLocation KeyLoc,
7822 IdentifierInfo *ParamName,
7823 SourceLocation ParamNameLoc,
7824 unsigned Depth, unsigned Position,
7825 SourceLocation EqualLoc,
7826 ParsedType DefaultArg, bool HasTypeConstraint);
7827
7828 bool ActOnTypeConstraint(const CXXScopeSpec &SS,
7830 TemplateTypeParmDecl *ConstrainedParameter,
7831 SourceLocation EllipsisLoc);
7832 bool BuildTypeConstraint(const CXXScopeSpec &SS,
7834 TemplateTypeParmDecl *ConstrainedParameter,
7835 SourceLocation EllipsisLoc,
7836 bool AllowUnexpandedPack);
7837
7839 DeclarationNameInfo NameInfo,
7840 ConceptDecl *NamedConcept,
7841 const TemplateArgumentListInfo *TemplateArgs,
7842 TemplateTypeParmDecl *ConstrainedParameter,
7843 SourceLocation EllipsisLoc);
7844
7846 NonTypeTemplateParmDecl *ConstrainedParameter,
7847 SourceLocation EllipsisLoc);
7848
7850
7852 SourceLocation Loc);
7854
7856 unsigned Depth,
7857 unsigned Position,
7858 SourceLocation EqualLoc,
7859 Expr *DefaultArg);
7861 SourceLocation TmpLoc,
7862 TemplateParameterList *Params,
7863 SourceLocation EllipsisLoc,
7864 IdentifierInfo *ParamName,
7865 SourceLocation ParamNameLoc,
7866 unsigned Depth,
7867 unsigned Position,
7868 SourceLocation EqualLoc,
7869 ParsedTemplateArgument DefaultArg);
7870
7872 ActOnTemplateParameterList(unsigned Depth,
7873 SourceLocation ExportLoc,
7874 SourceLocation TemplateLoc,
7875 SourceLocation LAngleLoc,
7876 ArrayRef<NamedDecl *> Params,
7877 SourceLocation RAngleLoc,
7878 Expr *RequiresClause);
7879
7880 /// The context in which we are checking a template parameter list.
7891
7893 TemplateParameterList *OldParams,
7895 SkipBodyInfo *SkipBody = nullptr);
7897 SourceLocation DeclStartLoc, SourceLocation DeclLoc,
7898 const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId,
7900 bool IsFriend, bool &IsMemberSpecialization, bool &Invalid,
7901 bool SuppressDiagnostic = false);
7902
7904 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
7905 CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc,
7906 const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams,
7907 AccessSpecifier AS, SourceLocation ModulePrivateLoc,
7908 SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists,
7909 TemplateParameterList **OuterTemplateParamLists,
7910 SkipBodyInfo *SkipBody = nullptr);
7911
7913 QualType NTTPType,
7914 SourceLocation Loc);
7915
7916 /// Get a template argument mapping the given template parameter to itself,
7917 /// e.g. for X in \c template<int X>, this would return an expression template
7918 /// argument referencing X.
7920 SourceLocation Location);
7921
7924
7926
7928
7930 SourceLocation TemplateLoc,
7931 TemplateArgumentListInfo &TemplateArgs);
7932
7935 TemplateTy Template, IdentifierInfo *TemplateII,
7936 SourceLocation TemplateIILoc, SourceLocation LAngleLoc,
7937 ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc,
7938 bool IsCtorOrDtorName = false, bool IsClassName = false);
7939
7940 /// Parsed an elaborated-type-specifier that refers to a template-id,
7941 /// such as \c class T::template apply<U>.
7943 TypeSpecifierType TagSpec,
7944 SourceLocation TagLoc,
7945 CXXScopeSpec &SS,
7946 SourceLocation TemplateKWLoc,
7947 TemplateTy TemplateD,
7948 SourceLocation TemplateLoc,
7949 SourceLocation LAngleLoc,
7950 ASTTemplateArgsPtr TemplateArgsIn,
7951 SourceLocation RAngleLoc);
7952
7954 Scope *S, Declarator &D, TypeSourceInfo *DI,
7955 SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams,
7957
7958 /// Get the specialization of the given variable template corresponding to
7959 /// the specified argument list, or a null-but-valid result if the arguments
7960 /// are dependent.
7962 SourceLocation TemplateLoc,
7963 SourceLocation TemplateNameLoc,
7964 const TemplateArgumentListInfo &TemplateArgs);
7965
7966 /// Form a reference to the specialization of the given variable template
7967 /// corresponding to the specified argument list, or a null-but-valid result
7968 /// if the arguments are dependent.
7970 const DeclarationNameInfo &NameInfo,
7971 VarTemplateDecl *Template,
7972 SourceLocation TemplateLoc,
7973 const TemplateArgumentListInfo *TemplateArgs);
7974
7977 SourceLocation TemplateKWLoc,
7978 const DeclarationNameInfo &ConceptNameInfo,
7979 NamedDecl *FoundDecl, ConceptDecl *NamedConcept,
7980 const TemplateArgumentListInfo *TemplateArgs);
7981
7983
7985 SourceLocation TemplateKWLoc,
7986 LookupResult &R,
7987 bool RequiresADL,
7988 const TemplateArgumentListInfo *TemplateArgs);
7989
7991 SourceLocation TemplateKWLoc,
7992 const DeclarationNameInfo &NameInfo,
7993 const TemplateArgumentListInfo *TemplateArgs);
7994
7996 Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc,
7997 const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext,
7998 TemplateTy &Template, bool AllowInjectedClassName = false);
7999
8001 Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc,
8002 SourceLocation ModulePrivateLoc, CXXScopeSpec &SS,
8004 MultiTemplateParamsArg TemplateParameterLists,
8005 SkipBodyInfo *SkipBody = nullptr);
8006
8008 TemplateDecl *PrimaryTemplate,
8009 unsigned NumExplicitArgs,
8015
8017 MultiTemplateParamsArg TemplateParameterLists,
8018 Declarator &D);
8019
8020 bool
8023 NamedDecl *PrevDecl,
8025 SourceLocation PrevPtOfInstantiation,
8026 bool &SuppressNew);
8027
8029 const TemplateArgumentListInfo &ExplicitTemplateArgs,
8031
8033 FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs,
8034 LookupResult &Previous, bool QualifiedFriend = false);
8037
8039 Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc,
8040 unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS,
8041 TemplateTy Template, SourceLocation TemplateNameLoc,
8042 SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs,
8043 SourceLocation RAngleLoc, const ParsedAttributesView &Attr);
8044
8046 SourceLocation TemplateLoc,
8047 unsigned TagSpec, SourceLocation KWLoc,
8048 CXXScopeSpec &SS, IdentifierInfo *Name,
8049 SourceLocation NameLoc,
8050 const ParsedAttributesView &Attr);
8051
8053 SourceLocation ExternLoc,
8054 SourceLocation TemplateLoc,
8055 Declarator &D);
8056
8059 SourceLocation TemplateLoc,
8060 SourceLocation RAngleLoc,
8061 Decl *Param,
8063 &Converted,
8064 bool &HasDefaultArg);
8065
8066 /// Specifies the context in which a particular template
8067 /// argument is being checked.
8069 /// The template argument was specified in the code or was
8070 /// instantiated with some deduced template arguments.
8072
8073 /// The template argument was deduced via template argument
8074 /// deduction.
8076
8077 /// The template argument was deduced from an array bound
8078 /// via template argument deduction.
8081
8082 bool CheckTemplateArgument(NamedDecl *Param,
8084 NamedDecl *Template,
8085 SourceLocation TemplateLoc,
8086 SourceLocation RAngleLoc,
8087 unsigned ArgumentPackIndex,
8090
8091 /// Check that the given template arguments can be be provided to
8092 /// the given template, converting the arguments along the way.
8093 ///
8094 /// \param Template The template to which the template arguments are being
8095 /// provided.
8096 ///
8097 /// \param TemplateLoc The location of the template name in the source.
8098 ///
8099 /// \param TemplateArgs The list of template arguments. If the template is
8100 /// a template template parameter, this function may extend the set of
8101 /// template arguments to also include substituted, defaulted template
8102 /// arguments.
8103 ///
8104 /// \param PartialTemplateArgs True if the list of template arguments is
8105 /// intentionally partial, e.g., because we're checking just the initial
8106 /// set of template arguments.
8107 ///
8108 /// \param Converted Will receive the converted, canonicalized template
8109 /// arguments.
8110 ///
8111 /// \param UpdateArgsWithConversions If \c true, update \p TemplateArgs to
8112 /// contain the converted forms of the template arguments as written.
8113 /// Otherwise, \p TemplateArgs will not be modified.
8114 ///
8115 /// \param ConstraintsNotSatisfied If provided, and an error occurred, will
8116 /// receive true if the cause for the error is the associated constraints of
8117 /// the template not being satisfied by the template arguments.
8118 ///
8119 /// \returns true if an error occurred, false otherwise.
8121 SourceLocation TemplateLoc,
8122 TemplateArgumentListInfo &TemplateArgs,
8123 bool PartialTemplateArgs,
8125 bool UpdateArgsWithConversions = true,
8126 bool *ConstraintsNotSatisfied = nullptr);
8127
8131
8134 QualType InstantiatedParamType, Expr *Arg,
8135 TemplateArgument &Converted,
8138 TemplateParameterList *Params,
8139 TemplateArgumentLoc &Arg);
8140
8143 QualType ParamType,
8144 SourceLocation Loc);
8147 SourceLocation Loc);
8148
8149 /// Enumeration describing how template parameter lists are compared
8150 /// for equality.
8152 /// We are matching the template parameter lists of two templates
8153 /// that might be redeclarations.
8154 ///
8155 /// \code
8156 /// template<typename T> struct X;
8157 /// template<typename T> struct X;
8158 /// \endcode
8160
8161 /// We are matching the template parameter lists of two template
8162 /// template parameters as part of matching the template parameter lists
8163 /// of two templates that might be redeclarations.
8164 ///
8165 /// \code
8166 /// template<template<int I> class TT> struct X;
8167 /// template<template<int Value> class Other> struct X;
8168 /// \endcode
8170
8171 /// We are matching the template parameter lists of a template
8172 /// template argument against the template parameter lists of a template
8173 /// template parameter.
8174 ///
8175 /// \code
8176 /// template<template<int Value> class Metafun> struct X;
8177 /// template<int Value> struct integer_c;
8178 /// X<integer_c> xic;
8179 /// \endcode
8182
8185 bool Complain,
8187 SourceLocation TemplateArgLoc
8188 = SourceLocation());
8189
8190 bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams);
8191
8192 /// Called when the parser has parsed a C++ typename
8193 /// specifier, e.g., "typename T::type".
8194 ///
8195 /// \param S The scope in which this typename type occurs.
8196 /// \param TypenameLoc the location of the 'typename' keyword
8197 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
8198 /// \param II the identifier we're retrieving (e.g., 'type' in the example).
8199 /// \param IdLoc the location of the identifier.
8201 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
8202 const CXXScopeSpec &SS, const IdentifierInfo &II,
8203 SourceLocation IdLoc);
8204
8205 /// Called when the parser has parsed a C++ typename
8206 /// specifier that ends in a template-id, e.g.,
8207 /// "typename MetaFun::template apply<T1, T2>".
8208 ///
8209 /// \param S The scope in which this typename type occurs.
8210 /// \param TypenameLoc the location of the 'typename' keyword
8211 /// \param SS the nested-name-specifier following the typename (e.g., 'T::').
8212 /// \param TemplateLoc the location of the 'template' keyword, if any.
8213 /// \param TemplateName The template name.
8214 /// \param TemplateII The identifier used to name the template.
8215 /// \param TemplateIILoc The location of the template name.
8216 /// \param LAngleLoc The location of the opening angle bracket ('<').
8217 /// \param TemplateArgs The template arguments.
8218 /// \param RAngleLoc The location of the closing angle bracket ('>').
8220 ActOnTypenameType(Scope *S, SourceLocation TypenameLoc,
8221 const CXXScopeSpec &SS,
8222 SourceLocation TemplateLoc,
8224 IdentifierInfo *TemplateII,
8225 SourceLocation TemplateIILoc,
8226 SourceLocation LAngleLoc,
8227 ASTTemplateArgsPtr TemplateArgs,
8228 SourceLocation RAngleLoc);
8229
8231 SourceLocation KeywordLoc,
8232 NestedNameSpecifierLoc QualifierLoc,
8233 const IdentifierInfo &II,
8234 SourceLocation IILoc,
8235 TypeSourceInfo **TSI,
8236 bool DeducedTSTContext);
8237
8239 SourceLocation KeywordLoc,
8240 NestedNameSpecifierLoc QualifierLoc,
8241 const IdentifierInfo &II,
8242 SourceLocation IILoc,
8243 bool DeducedTSTContext = true);
8244
8245
8247 SourceLocation Loc,
8248 DeclarationName Name);
8250
8253 TemplateParameterList *Params);
8254
8255 std::string
8257 const TemplateArgumentList &Args);
8258
8259 std::string
8261 const TemplateArgument *Args,
8262 unsigned NumArgs);
8263
8264 //===--------------------------------------------------------------------===//
8265 // C++ Concepts
8266 //===--------------------------------------------------------------------===//
8268 Scope *S, MultiTemplateParamsArg TemplateParameterLists,
8269 IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr);
8270
8272 bool &AddToScope);
8273
8276 ArrayRef<ParmVarDecl *> LocalParameters,
8277 Scope *BodyScope);
8281 SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc,
8282 IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId);
8284 SourceLocation NoexceptLoc);
8287 Expr *E, SourceLocation NoexceptLoc, CXXScopeSpec &SS,
8288 TemplateIdAnnotation *TypeConstraint, unsigned Depth);
8292 Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc,
8297 bool IsSatisfied, SourceLocation NoexceptLoc,
8309 ArrayRef<ParmVarDecl *> LocalParameters,
8311 SourceLocation ClosingBraceLoc);
8312
8313 //===--------------------------------------------------------------------===//
8314 // C++ Variadic Templates (C++0x [temp.variadic])
8315 //===--------------------------------------------------------------------===//
8316
8317 /// Determine whether an unexpanded parameter pack might be permitted in this
8318 /// location. Useful for error recovery.
8320
8321 /// The context in which an unexpanded parameter pack is
8322 /// being diagnosed.
8323 ///
8324 /// Note that the values of this enumeration line up with the first
8325 /// argument to the \c err_unexpanded_parameter_pack diagnostic.
8327 /// An arbitrary expression.
8329
8330 /// The base type of a class type.
8332
8333 /// The type of an arbitrary declaration.
8335
8336 /// The type of a data member.
8338
8339 /// The size of a bit-field.
8341
8342 /// The expression in a static assertion.
8344
8345 /// The fixed underlying type of an enumeration.
8347
8348 /// The enumerator value.
8350
8351 /// A using declaration.
8353
8354 /// A friend declaration.
8356
8357 /// A declaration qualifier.
8359
8360 /// An initializer.
8362
8363 /// A default argument.
8365
8366 /// The type of a non-type template parameter.
8368
8369 /// The type of an exception.
8371
8372 /// Partial specialization.
8374
8375 /// Microsoft __if_exists.
8377
8378 /// Microsoft __if_not_exists.
8380
8381 /// Lambda expression.
8383
8384 /// Block expression.
8386
8387 /// A type constraint.
8389
8390 // A requirement in a requires-expression.
8392
8393 // A requires-clause.
8395 };
8396
8397 /// Diagnose unexpanded parameter packs.
8398 ///
8399 /// \param Loc The location at which we should emit the diagnostic.
8400 ///
8401 /// \param UPPC The context in which we are diagnosing unexpanded
8402 /// parameter packs.
8403 ///
8404 /// \param Unexpanded the set of unexpanded parameter packs.
8405 ///
8406 /// \returns true if an error occurred, false otherwise.
8410
8411 /// If the given type contains an unexpanded parameter pack,
8412 /// diagnose the error.
8413 ///
8414 /// \param Loc The source location where a diagnostc should be emitted.
8415 ///
8416 /// \param T The type that is being checked for unexpanded parameter
8417 /// packs.
8418 ///
8419 /// \returns true if an error occurred, false otherwise.
8422
8423 /// If the given expression contains an unexpanded parameter
8424 /// pack, diagnose the error.
8425 ///
8426 /// \param E The expression that is being checked for unexpanded
8427 /// parameter packs.
8428 ///
8429 /// \returns true if an error occurred, false otherwise.
8432
8433 /// If the given requirees-expression contains an unexpanded reference to one
8434 /// of its own parameter packs, diagnose the error.
8435 ///
8436 /// \param RE The requiress-expression that is being checked for unexpanded
8437 /// parameter packs.
8438 ///
8439 /// \returns true if an error occurred, false otherwise.
8441
8442 /// If the given nested-name-specifier contains an unexpanded
8443 /// parameter pack, diagnose the error.
8444 ///
8445 /// \param SS The nested-name-specifier that is being checked for
8446 /// unexpanded parameter packs.
8447 ///
8448 /// \returns true if an error occurred, false otherwise.
8451
8452 /// If the given name contains an unexpanded parameter pack,
8453 /// diagnose the error.
8454 ///
8455 /// \param NameInfo The name (with source location information) that
8456 /// is being checked for unexpanded parameter packs.
8457 ///
8458 /// \returns true if an error occurred, false otherwise.
8461
8462 /// If the given template name contains an unexpanded parameter pack,
8463 /// diagnose the error.
8464 ///
8465 /// \param Loc The location of the template name.
8466 ///
8467 /// \param Template The template name that is being checked for unexpanded
8468 /// parameter packs.
8469 ///
8470 /// \returns true if an error occurred, false otherwise.
8472 TemplateName Template,
8474
8475 /// If the given template argument contains an unexpanded parameter
8476 /// pack, diagnose the error.
8477 ///
8478 /// \param Arg The template argument that is being checked for unexpanded
8479 /// parameter packs.
8480 ///
8481 /// \returns true if an error occurred, false otherwise.
8484
8485 /// Collect the set of unexpanded parameter packs within the given
8486 /// template argument.
8487 ///
8488 /// \param Arg The template argument that will be traversed to find
8489 /// unexpanded parameter packs.
8492
8493 /// Collect the set of unexpanded parameter packs within the given
8494 /// template argument.
8495 ///
8496 /// \param Arg The template argument that will be traversed to find
8497 /// unexpanded parameter packs.
8500
8501 /// Collect the set of unexpanded parameter packs within the given
8502 /// type.
8503 ///
8504 /// \param T The type that will be traversed to find
8505 /// unexpanded parameter packs.
8508
8509 /// Collect the set of unexpanded parameter packs within the given
8510 /// type.
8511 ///
8512 /// \param TL The type that will be traversed to find
8513 /// unexpanded parameter packs.
8516
8517 /// Collect the set of unexpanded parameter packs within the given
8518 /// nested-name-specifier.
8519 ///
8520 /// \param NNS The nested-name-specifier that will be traversed to find
8521 /// unexpanded parameter packs.
8524
8525 /// Collect the set of unexpanded parameter packs within the given
8526 /// name.
8527 ///
8528 /// \param NameInfo The name that will be traversed to find
8529 /// unexpanded parameter packs.
8532
8533 /// Invoked when parsing a template argument followed by an
8534 /// ellipsis, which creates a pack expansion.
8535 ///
8536 /// \param Arg The template argument preceding the ellipsis, which
8537 /// may already be invalid.
8538 ///
8539 /// \param EllipsisLoc The location of the ellipsis.
8541 SourceLocation EllipsisLoc);
8542
8543 /// Invoked when parsing a type followed by an ellipsis, which
8544 /// creates a pack expansion.
8545 ///
8546 /// \param Type The type preceding the ellipsis, which will become
8547 /// the pattern of the pack expansion.
8548 ///
8549 /// \param EllipsisLoc The location of the ellipsis.
8551
8552 /// Construct a pack expansion type from the pattern of the pack
8553 /// expansion.
8555 SourceLocation EllipsisLoc,
8556 Optional<unsigned> NumExpansions);
8557
8558 /// Construct a pack expansion type from the pattern of the pack
8559 /// expansion.
8561 SourceRange PatternRange,
8562 SourceLocation EllipsisLoc,
8563 Optional<unsigned> NumExpansions);
8564
8565 /// Invoked when parsing an expression followed by an ellipsis, which
8566 /// creates a pack expansion.
8567 ///
8568 /// \param Pattern The expression preceding the ellipsis, which will become
8569 /// the pattern of the pack expansion.
8570 ///
8571 /// \param EllipsisLoc The location of the ellipsis.
8572 ExprResult ActOnPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc);
8573
8574 /// Invoked when parsing an expression followed by an ellipsis, which
8575 /// creates a pack expansion.
8576 ///
8577 /// \param Pattern The expression preceding the ellipsis, which will become
8578 /// the pattern of the pack expansion.
8579 ///
8580 /// \param EllipsisLoc The location of the ellipsis.
8581 ExprResult CheckPackExpansion(Expr *Pattern, SourceLocation EllipsisLoc,
8582 Optional<unsigned> NumExpansions);
8583
8584 /// Determine whether we could expand a pack expansion with the
8585 /// given set of parameter packs into separate arguments by repeatedly
8586 /// transforming the pattern.
8587 ///
8588 /// \param EllipsisLoc The location of the ellipsis that identifies the
8589 /// pack expansion.
8590 ///
8591 /// \param PatternRange The source range that covers the entire pattern of
8592 /// the pack expansion.
8593 ///
8594 /// \param Unexpanded The set of unexpanded parameter packs within the
8595 /// pattern.
8596 ///
8597 /// \param ShouldExpand Will be set to \c true if the transformer should
8598 /// expand the corresponding pack expansions into separate arguments. When
8599 /// set, \c NumExpansions must also be set.
8600 ///
8601 /// \param RetainExpansion Whether the caller should add an unexpanded
8602 /// pack expansion after all of the expanded arguments. This is used
8603 /// when extending explicitly-specified template argument packs per
8604 /// C++0x [temp.arg.explicit]p9.
8605 ///
8606 /// \param NumExpansions The number of separate arguments that will be in
8607 /// the expanded form of the corresponding pack expansion. This is both an
8608 /// input and an output parameter, which can be set by the caller if the
8609 /// number of expansions is known a priori (e.g., due to a prior substitution)
8610 /// and will be set by the callee when the number of expansions is known.
8611 /// The callee must set this value when \c ShouldExpand is \c true; it may
8612 /// set this value in other cases.
8613 ///
8614 /// \returns true if an error occurred (e.g., because the parameter packs
8615 /// are to be instantiated with arguments of different lengths), false
8616 /// otherwise. If false, \c ShouldExpand (and possibly \c NumExpansions)
8617 /// must be set.
8619 SourceRange PatternRange,
8621 const MultiLevelTemplateArgumentList &TemplateArgs,
8622 bool &ShouldExpand,
8623 bool &RetainExpansion,
8624 Optional<unsigned> &NumExpansions);
8625
8626 /// Determine the number of arguments in the given pack expansion
8627 /// type.
8628 ///
8629 /// This routine assumes that the number of arguments in the expansion is
8630 /// consistent across all of the unexpanded parameter packs in its pattern.
8631 ///
8632 /// Returns an empty Optional if the type can't be expanded.
8634 const MultiLevelTemplateArgumentList &TemplateArgs);
8635
8636 /// Determine whether the given declarator contains any unexpanded
8637 /// parameter packs.
8638 ///
8639 /// This routine is used by the parser to disambiguate function declarators
8640 /// with an ellipsis prior to the ')', e.g.,
8641 ///
8642 /// \code
8643 /// void f(T...);
8644 /// \endcode
8645 ///
8646 /// To determine whether we have an (unnamed) function parameter pack or
8647 /// a variadic function.
8648 ///
8649 /// \returns true if the declarator contains any unexpanded parameter packs,
8650 /// false otherwise.
8652
8653 /// Returns the pattern of the pack expansion for a template argument.
8654 ///
8655 /// \param OrigLoc The template argument to expand.
8656 ///
8657 /// \param Ellipsis Will be set to the location of the ellipsis.
8658 ///
8659 /// \param NumExpansions Will be set to the number of expansions that will
8660 /// be generated from this pack expansion, if known a priori.
8662 TemplateArgumentLoc OrigLoc,
8663 SourceLocation &Ellipsis,
8664 Optional<unsigned> &NumExpansions) const;
8665
8666 /// Given a template argument that contains an unexpanded parameter pack, but
8667 /// which has already been substituted, attempt to determine the number of
8668 /// elements that will be produced once this argument is fully-expanded.
8669 ///
8670 /// This is intended for use when transforming 'sizeof...(Arg)' in order to
8671 /// avoid actually expanding the pack where possible.
8673
8674 //===--------------------------------------------------------------------===//
8675 // C++ Template Argument Deduction (C++ [temp.deduct])
8676 //===--------------------------------------------------------------------===//
8677
8678 /// Adjust the type \p ArgFunctionType to match the calling convention,
8679 /// noreturn, and optionally the exception specification of \p FunctionType.
8680 /// Deduction often wants to ignore these properties when matching function
8681 /// types.
8683 bool AdjustExceptionSpec = false);
8684
8685 /// Describes the result of template argument deduction.
8686 ///
8687 /// The TemplateDeductionResult enumeration describes the result of
8688 /// template argument deduction, as returned from
8689 /// DeduceTemplateArguments(). The separate TemplateDeductionInfo
8690 /// structure provides additional information about the results of
8691 /// template argument deduction, e.g., the deduced template argument
8692 /// list (if successful) or the specific template parameters or
8693 /// deduced arguments that were involved in the failure.
8695 /// Template argument deduction was successful.
8697 /// The declaration was invalid; do nothing.
8699 /// Template argument deduction exceeded the maximum template
8700 /// instantiation depth (which has already been diagnosed).
8702 /// Template argument deduction did not deduce a value
8703 /// for every template parameter.
8705 /// Template argument deduction did not deduce a value for every
8706 /// expansion of an expanded template parameter pack.
8708 /// Template argument deduction produced inconsistent
8709 /// deduced values for the given template parameter.
8711 /// Template argument deduction failed due to inconsistent
8712 /// cv-qualifiers on a template parameter type that would
8713 /// otherwise be deduced, e.g., we tried to deduce T in "const T"
8714 /// but were given a non-const "X".
8716 /// Substitution of the deduced template argument values
8717 /// resulted in an error.
8719 /// After substituting deduced template arguments, a dependent
8720 /// parameter type did not match the corresponding argument.
8722 /// After substituting deduced template arguments, an element of
8723 /// a dependent parameter type did not match the corresponding element
8724 /// of the corresponding argument (when deducing from an initializer list).
8726 /// A non-depnedent component of the parameter did not match the
8727 /// corresponding component of the argument.
8729 /// When performing template argument deduction for a function
8730 /// template, there were too many call arguments.
8732 /// When performing template argument deduction for a function
8733 /// template, there were too few call arguments.
8735 /// The explicitly-specified template arguments were not valid
8736 /// template arguments for the given template.
8738 /// Checking non-dependent argument conversions failed.
8740 /// The deduced arguments did not satisfy the constraints associated
8741 /// with the template.
8743 /// Deduction failed; that's all we know.
8745 /// CUDA Target attributes do not match.
8748
8751 const TemplateArgumentList &TemplateArgs,
8753
8756 const TemplateArgumentList &TemplateArgs,
8758
8761 TemplateArgumentListInfo &ExplicitTemplateArgs,
8765
8766 /// brief A function argument from which we performed template argument
8767 // deduction for a call.
8780
8784 unsigned NumExplicitlySpecified, FunctionDecl *&Specialization,
8786 SmallVectorImpl<OriginalCallArg> const *OriginalCallArgs = nullptr,
8787 bool PartialOverloading = false,
8788 llvm::function_ref<bool()> CheckNonDependent = []{ return false; });
8789
8792 TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,
8794 bool PartialOverloading,
8795 llvm::function_ref<bool(ArrayRef<QualType>)> CheckNonDependent);
8796
8799 TemplateArgumentListInfo *ExplicitTemplateArgs,
8800 QualType ArgFunctionType,
8803 bool IsAddressOfFunction = false);
8804
8807 QualType ToType,
8810
8813 TemplateArgumentListInfo *ExplicitTemplateArgs,
8816 bool IsAddressOfFunction = false);
8817
8818 /// Substitute Replacement for \p auto in \p TypeWithAuto
8819 QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement);
8820 /// Substitute Replacement for auto in TypeWithAuto
8822 QualType Replacement);
8823
8824 // Substitute auto in TypeWithAuto for a Dependent auto type
8826
8827 // Substitute auto in TypeWithAuto for a Dependent auto type
8830
8831 /// Completely replace the \c auto in \p TypeWithAuto by
8832 /// \p Replacement. This does not retain any \c auto type sugar.
8833 QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement);
8835 QualType Replacement);
8836
8837 /// Result type of DeduceAutoType.
8843
8846 Optional<unsigned> DependentDeductionDepth = None,
8847 bool IgnoreConstraints = false);
8850 Optional<unsigned> DependentDeductionDepth = None,
8851 bool IgnoreConstraints = false);
8852 void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init);
8854 bool Diagnose = true);
8855
8856 /// Declare implicit deduction guides for a class template if we've
8857 /// not already done so.
8859 SourceLocation Loc);
8860
8862 TypeSourceInfo *TInfo, const InitializedEntity &Entity,
8863 const InitializationKind &Kind, MultiExprArg Init);
8864
8867 SourceRange Range, bool DirectInit,
8868 Expr *Init);
8869
8871
8873 SourceLocation ReturnLoc,
8874 Expr *&RetExpr, const AutoType *AT);
8875
8878 TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1,
8879 unsigned NumCallArguments2, bool Reversed = false,
8880 bool AllowOrderingByConstraints = true);
8883 TemplateSpecCandidateSet &FailedCandidates,
8884 SourceLocation Loc,
8885 const PartialDiagnostic &NoneDiag,
8886 const PartialDiagnostic &AmbigDiag,
8887 const PartialDiagnostic &CandidateDiag,
8888 bool Complain = true, QualType TargetType = QualType());
8889
8894 SourceLocation Loc);
8895
8898
8902
8905
8908
8909 void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced,
8910 unsigned Depth, llvm::SmallBitVector &Used);
8911
8912 void MarkUsedTemplateParameters(const TemplateArgumentList &TemplateArgs,
8913 bool OnlyDeduced,
8914 unsigned Depth,
8915 llvm::SmallBitVector &Used);
8918 llvm::SmallBitVector &Deduced) {
8920 }
8923 llvm::SmallBitVector &Deduced);
8924
8925 //===--------------------------------------------------------------------===//
8926 // C++ Template Instantiation
8927 //
8928
8930 const NamedDecl *D, const TemplateArgumentList *Innermost = nullptr,
8931 bool RelativeToPrimary = false, const FunctionDecl *Pattern = nullptr);
8932
8933 /// A context in which code is being synthesized (where a source location
8934 /// alone is not sufficient to identify the context). This covers template
8935 /// instantiation and various forms of implicitly-generated functions.
8937 /// The kind of template instantiation we are performing
8939 /// We are instantiating a template declaration. The entity is
8940 /// the declaration we're instantiating (e.g., a CXXRecordDecl).
8942
8943 /// We are instantiating a default argument for a template
8944 /// parameter. The Entity is the template parameter whose argument is
8945 /// being instantiated, the Template is the template, and the
8946 /// TemplateArgs/NumTemplateArguments provide the template arguments as
8947 /// specified.
8949
8950 /// We are instantiating a default argument for a function.
8951 /// The Entity is the ParmVarDecl, and TemplateArgs/NumTemplateArgs
8952 /// provides the template arguments as specified.
8954
8955 /// We are substituting explicit template arguments provided for
8956 /// a function template. The entity is a FunctionTemplateDecl.
8958
8959 /// We are substituting template argument determined as part of
8960 /// template argument deduction for either a class template
8961 /// partial specialization or a function template. The
8962 /// Entity is either a {Class|Var}TemplatePartialSpecializationDecl or
8963 /// a TemplateDecl.
8965
8966 /// We are substituting prior template arguments into a new
8967 /// template parameter. The template parameter itself is either a
8968 /// NonTypeTemplateParmDecl or a TemplateTemplateParmDecl.
8970
8971 /// We are checking the validity of a default template argument that
8972 /// has been used when naming a template-id.
8974
8975 /// We are computing the exception specification for a defaulted special
8976 /// member function.
8978
8979 /// We are instantiating the exception specification for a function
8980 /// template which was deferred until it was needed.
8982
8983 /// We are instantiating a requirement of a requires expression.
8985
8986 /// We are checking the satisfaction of a nested requirement of a requires
8987 /// expression.
8989
8990 /// We are declaring an implicit special member function.
8992
8993 /// We are declaring an implicit 'operator==' for a defaulted
8994 /// 'operator<=>'.
8996
8997 /// We are defining a synthesized function (such as a defaulted special
8998 /// member).
9000
9001 // We are checking the constraints associated with a constrained entity or
9002 // the constraint expression of a concept. This includes the checks that
9003 // atomic constraints have the type 'bool' and that they can be constant
9004 // evaluated.
9006
9007 // We are substituting template arguments into a constraint expression.
9009
9010 // We are normalizing a constraint expression.
9012
9013 // We are substituting into the parameter mapping of an atomic constraint
9014 // during normalization.
9016
9017 /// We are rewriting a comparison operator in terms of an operator<=>.
9019
9020 /// We are initializing a structured binding.
9022
9023 /// We are marking a class as __dllexport.
9025
9026 /// We are building an implied call from __builtin_dump_struct. The
9027 /// arguments are in CallArgs.
9029
9030 /// Added for Template instantiation observation.
9031 /// Memoization means we are _not_ instantiating a template because
9032 /// it is already instantiated (but we entered a context where we
9033 /// would have had to if it was not already instantiated).
9036
9037 /// Was the enclosing context a non-instantiation SFINAE context?
9039
9040 /// The point of instantiation or synthesis within the source code.
9042
9043 /// The entity that is being synthesized.
9045
9046 /// The template (or partial specialization) in which we are
9047 /// performing the instantiation, for substitutions of prior template
9048 /// arguments.
9050
9051 union {
9052 /// The list of template arguments we are substituting, if they
9053 /// are not part of the entity.
9055
9056 /// The list of argument expressions in a synthesized call.
9057 const Expr *const *CallArgs;
9058 };
9059
9060 // FIXME: Wrap this union around more members, or perhaps store the
9061 // kind-specific members in the RAII object owning the context.
9062 union {
9063 /// The number of template arguments in TemplateArgs.
9065
9066 /// The number of expressions in CallArgs.
9067 unsigned NumCallArgs;
9068
9069 /// The special member being declared or defined.
9071 };
9072
9074 assert(Kind != DeclaringSpecialMember);
9075 return {TemplateArgs, NumTemplateArgs};
9076 }
9077
9078 /// The template deduction info object associated with the
9079 /// substitution or checking of explicit or deduced template arguments.
9081
9082 /// The source range that covers the construct that cause
9083 /// the instantiation, e.g., the template-id that causes a class
9084 /// template instantiation.
9086
9092
9093 /// Determines whether this template is an actual instantiation
9094 /// that should be counted toward the maximum instantiation depth.
9095 bool isInstantiationRecord() const;
9096 };
9097
9098 /// List of active code synthesis contexts.
9099 ///
9100 /// This vector is treated as a stack. As synthesis of one entity requires
9101 /// synthesis of another, additional contexts are pushed onto the stack.
9103
9104 /// Specializations whose definitions are currently being instantiated.
9106
9107 /// Non-dependent types used in templates that have already been instantiated
9108 /// by some template instantiation.
9110
9111 /// Extra modules inspected when performing a lookup during a template
9112 /// instantiation. Computed lazily.
9114
9115 /// Cache of additional modules that should be used for name lookup
9116 /// within the current template instantiation. Computed lazily; use
9117 /// getLookupModules() to get a complete set.
9119
9120 /// Get the set of additional modules that should be checked during
9121 /// name lookup. A module and its imports become visible when instanting a
9122 /// template defined within it.
9124
9125 /// Map from the most recent declaration of a namespace to the most
9126 /// recent visible declaration of that namespace.
9127 llvm::DenseMap<NamedDecl*, NamedDecl*> VisibleNamespaceCache;
9128
9129 /// Whether we are in a SFINAE context that is not associated with
9130 /// template instantiation.
9131 ///
9132 /// This is used when setting up a SFINAE trap (\c see SFINAETrap) outside
9133 /// of a template instantiation or template argument deduction.
9135
9136 /// The number of \p CodeSynthesisContexts that are not template
9137 /// instantiations and, therefore, should not be counted as part of the
9138 /// instantiation depth.
9139 ///
9140 /// When the instantiation depth reaches the user-configurable limit
9141 /// \p LangOptions::InstantiationDepth we will abort instantiation.
9142 // FIXME: Should we have a similar limit for other forms of synthesis?
9144
9145 /// The depth of the context stack at the point when the most recent
9146 /// error or warning was produced.
9147 ///
9148 /// This value is used to suppress printing of redundant context stacks
9149 /// when there are multiple errors or warnings in the same instantiation.
9150 // FIXME: Does this belong in Sema? It's tough to implement it anywhere else.
9152
9153 /// The template instantiation callbacks to trace or track
9154 /// instantiations (objects can be chained).
9155 ///
9156 /// This callbacks is used to print, trace or track template
9157 /// instantiations as they are being constructed.
9158 std::vector<std::unique_ptr<TemplateInstantiationCallback>>
9160
9161 /// The current index into pack expansion arguments that will be
9162 /// used for substitution of parameter packs.
9163 ///
9164 /// The pack expansion index will be -1 to indicate that parameter packs
9165 /// should be instantiated as themselves. Otherwise, the index specifies
9166 /// which argument within the parameter pack will be used for substitution.
9168
9169 /// RAII object used to change the argument pack substitution index
9170 /// within a \c Sema object.
9171 ///
9172 /// See \c ArgumentPackSubstitutionIndex for more information.
9174 Sema &Self;
9175 int OldSubstitutionIndex;
9176
9177 public:
9178 ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
9179 : Self(Self), OldSubstitutionIndex(Self.ArgumentPackSubstitutionIndex) {
9180 Self.ArgumentPackSubstitutionIndex = NewSubstitutionIndex;
9181 }
9182
9184 Self.ArgumentPackSubstitutionIndex = OldSubstitutionIndex;
9185 }
9186 };
9187
9189
9190 /// For each declaration that involved template argument deduction, the
9191 /// set of diagnostics that were suppressed during that template argument
9192 /// deduction.
9193 ///
9194 /// FIXME: Serialize this structure to the AST file.
9195 typedef llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >
9198
9199 /// A stack object to be created when performing template
9200 /// instantiation.
9201 ///
9202 /// Construction of an object of type \c InstantiatingTemplate
9203 /// pushes the current instantiation onto the stack of active
9204 /// instantiations. If the size of this stack exceeds the maximum
9205 /// number of recursive template instantiations, construction
9206 /// produces an error and evaluates true.
9207 ///
9208 /// Destruction of this object will pop the named instantiation off
9209 /// the stack.
9211 /// Note that we are instantiating a class template,
9212 /// function template, variable template, alias template,
9213 /// or a member thereof.
9214 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9215 Decl *Entity,
9216 SourceRange InstantiationRange = SourceRange());
9217
9219 /// Note that we are instantiating an exception specification
9220 /// of a function template.
9221 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9223 SourceRange InstantiationRange = SourceRange());
9224
9225 /// Note that we are instantiating a default argument in a
9226 /// template-id.
9227 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9228 TemplateParameter Param, TemplateDecl *Template,
9229 ArrayRef<TemplateArgument> TemplateArgs,
9230 SourceRange InstantiationRange = SourceRange());
9231
9232 /// Note that we are substituting either explicitly-specified or
9233 /// deduced template arguments during function template argument deduction.
9234 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9236 ArrayRef<TemplateArgument> TemplateArgs,
9238 sema::TemplateDeductionInfo &DeductionInfo,
9239 SourceRange InstantiationRange = SourceRange());
9240
9241 /// Note that we are instantiating as part of template
9242 /// argument deduction for a class template declaration.
9243 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9244 TemplateDecl *Template,
9245 ArrayRef<TemplateArgument> TemplateArgs,
9246 sema::TemplateDeductionInfo &DeductionInfo,
9247 SourceRange InstantiationRange = SourceRange());
9248
9249 /// Note that we are instantiating as part of template
9250 /// argument deduction for a class template partial
9251 /// specialization.
9252 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9254 ArrayRef<TemplateArgument> TemplateArgs,
9255 sema::TemplateDeductionInfo &DeductionInfo,
9256 SourceRange InstantiationRange = SourceRange());
9257
9258 /// Note that we are instantiating as part of template
9259 /// argument deduction for a variable template partial
9260 /// specialization.
9261 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9263 ArrayRef<TemplateArgument> TemplateArgs,
9264 sema::TemplateDeductionInfo &DeductionInfo,
9265 SourceRange InstantiationRange = SourceRange());
9266
9267 /// Note that we are instantiating a default argument for a function
9268 /// parameter.
9269 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9270 ParmVarDecl *Param,
9271 ArrayRef<TemplateArgument> TemplateArgs,
9272 SourceRange InstantiationRange = SourceRange());
9273
9274 /// Note that we are substituting prior template arguments into a
9275 /// non-type parameter.
9276 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9277 NamedDecl *Template,
9279 ArrayRef<TemplateArgument> TemplateArgs,
9280 SourceRange InstantiationRange);
9281
9282 /// Note that we are substituting prior template arguments into a
9283 /// template template parameter.
9284 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9285 NamedDecl *Template,
9287 ArrayRef<TemplateArgument> TemplateArgs,
9288 SourceRange InstantiationRange);
9289
9290 /// Note that we are checking the default template argument
9291 /// against the template parameter for a given template-id.
9292 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9293 TemplateDecl *Template,
9294 NamedDecl *Param,
9295 ArrayRef<TemplateArgument> TemplateArgs,
9296 SourceRange InstantiationRange);
9297
9299 /// \brief Note that we are checking the constraints associated with some
9300 /// constrained entity (a concept declaration or a template with associated
9301 /// constraints).
9302 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9303 ConstraintsCheck, NamedDecl *Template,
9304 ArrayRef<TemplateArgument> TemplateArgs,
9305 SourceRange InstantiationRange);
9306
9308 /// \brief Note that we are checking a constraint expression associated
9309 /// with a template declaration or as part of the satisfaction check of a
9310 /// concept.
9311 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9313 sema::TemplateDeductionInfo &DeductionInfo,
9314 SourceRange InstantiationRange);
9315
9317 /// \brief Note that we are normalizing a constraint expression.
9318 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9320 SourceRange InstantiationRange);
9321
9323 /// \brief Note that we are subtituting into the parameter mapping of an
9324 /// atomic constraint during constraint normalization.
9325 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9327 SourceRange InstantiationRange);
9328
9329 /// \brief Note that we are substituting template arguments into a part of
9330 /// a requirement of a requires expression.
9331 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9333 sema::TemplateDeductionInfo &DeductionInfo,
9334 SourceRange InstantiationRange = SourceRange());
9335
9336 /// \brief Note that we are checking the satisfaction of the constraint
9337 /// expression inside of a nested requirement.
9338 InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation,
9340 SourceRange InstantiationRange = SourceRange());
9341
9342 /// Note that we have finished instantiating this template.
9343 void Clear();
9344
9346
9347 /// Determines whether we have exceeded the maximum
9348 /// recursive template instantiations.
9349 bool isInvalid() const { return Invalid; }
9350
9351 /// Determine whether we are already instantiating this
9352 /// specialization in some surrounding active instantiation.
9353 bool isAlreadyInstantiating() const { return AlreadyInstantiating; }
9354
9355 private:
9356 Sema &SemaRef;
9357 bool Invalid;
9358 bool AlreadyInstantiating;
9359 bool CheckInstantiationDepth(SourceLocation PointOfInstantiation,
9360 SourceRange InstantiationRange);
9361
9364 SourceLocation PointOfInstantiation, SourceRange InstantiationRange,
9365 Decl *Entity, NamedDecl *Template = nullptr,
9366 ArrayRef<TemplateArgument> TemplateArgs = None,
9367 sema::TemplateDeductionInfo *DeductionInfo = nullptr);
9368
9370
9372 operator=(const InstantiatingTemplate&) = delete;
9373 };
9374
9375 void pushCodeSynthesisContext(CodeSynthesisContext Ctx);
9377
9378 /// Determine whether we are currently performing template instantiation.
9381 }
9382
9393
9395
9396 /// Determines whether we are currently in a context where
9397 /// template argument substitution failures are not considered
9398 /// errors.
9399 ///
9400 /// \returns An empty \c Optional if we're not in a SFINAE context.
9401 /// Otherwise, contains a pointer that, if non-NULL, contains the nearest
9402 /// template-deduction context object, which can be used to capture
9403 /// diagnostics that will be suppressed.
9405
9406 /// Determines whether we are currently in a context that
9407 /// is not evaluated as per C++ [expr] p5.
9409 assert(!ExprEvalContexts.empty() &&
9410 "Must be in an expression evaluation context");
9411 return ExprEvalContexts.back().isUnevaluated();
9412 }
9413
9415 assert(!ExprEvalContexts.empty() &&
9416 "Must be in an expression evaluation context");
9417 return ExprEvalContexts.back().isImmediateFunctionContext();
9418 }
9419
9420 /// RAII class used to determine whether SFINAE has
9421 /// trapped any errors that occur during template argument
9422 /// deduction.
9424 Sema &SemaRef;
9425 unsigned PrevSFINAEErrors;
9426 bool PrevInNonInstantiationSFINAEContext;
9427 bool PrevAccessCheckingSFINAE;
9428 bool PrevLastDiagnosticIgnored;
9429
9430 public:
9431 explicit SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE = false)
9432 : SemaRef(SemaRef), PrevSFINAEErrors(SemaRef.NumSFINAEErrors),
9433 PrevInNonInstantiationSFINAEContext(
9435 PrevAccessCheckingSFINAE(SemaRef.AccessCheckingSFINAE),
9436 PrevLastDiagnosticIgnored(
9437 SemaRef.getDiagnostics().isLastDiagnosticIgnored())
9438 {
9439 if (!SemaRef.isSFINAEContext())
9440 SemaRef.InNonInstantiationSFINAEContext = true;
9442 }
9443
9445 SemaRef.NumSFINAEErrors = PrevSFINAEErrors;
9447 = PrevInNonInstantiationSFINAEContext;
9448 SemaRef.AccessCheckingSFINAE = PrevAccessCheckingSFINAE;
9450 PrevLastDiagnosticIgnored);
9451 }
9452
9453 /// Determine whether any SFINAE errors have been trapped.
9454 bool hasErrorOccurred() const {
9455 return SemaRef.NumSFINAEErrors > PrevSFINAEErrors;
9456 }
9457 };
9458
9459 /// RAII class used to indicate that we are performing provisional
9460 /// semantic analysis to determine the validity of a construct, so
9461 /// typo-correction and diagnostics in the immediate context (not within
9462 /// implicitly-instantiated templates) should be suppressed.
9464 Sema &SemaRef;
9465 // FIXME: Using a SFINAETrap for this is a hack.
9466 SFINAETrap Trap;
9467 bool PrevDisableTypoCorrection;
9468 public:
9469 explicit TentativeAnalysisScope(Sema &SemaRef)
9470 : SemaRef(SemaRef), Trap(SemaRef, true),
9471 PrevDisableTypoCorrection(SemaRef.DisableTypoCorrection) {
9472 SemaRef.DisableTypoCorrection = true;
9473 }
9475 SemaRef.DisableTypoCorrection = PrevDisableTypoCorrection;
9476 }
9477 };
9478
9479 /// The current instantiation scope used to store local
9480 /// variables.
9482
9483 /// Tracks whether we are in a context where typo correction is
9484 /// disabled.
9486
9487 /// The number of typos corrected by CorrectTypo.
9489
9490 typedef llvm::SmallSet<SourceLocation, 2> SrcLocSet;
9491 typedef llvm::DenseMap<IdentifierInfo *, SrcLocSet> IdentifierSourceLocations;
9492
9493 /// A cache containing identifiers for which typo correction failed and
9494 /// their locations, so that repeated attempts to correct an identifier in a
9495 /// given location are ignored if typo correction already failed for it.
9497
9498 /// Worker object for performing CFG-based warnings.
9501
9502 /// An entity for which implicit template instantiation is required.
9503 ///
9504 /// The source location associated with the declaration is the first place in
9505 /// the source code where the declaration was "used". It is not necessarily
9506 /// the point of instantiation (which will be either before or after the
9507 /// namespace-scope declaration that triggered this implicit instantiation),
9508 /// However, it is the location that diagnostics should generally refer to,
9509 /// because users will need to know what code triggered the instantiation.
9510 typedef std::pair<ValueDecl *, SourceLocation> PendingImplicitInstantiation;
9511
9512 /// The queue of implicit template instantiations that are required
9513 /// but have not yet been performed.
9514 std::deque<PendingImplicitInstantiation> PendingInstantiations;
9515
9516 /// Queue of implicit template instantiations that cannot be performed
9517 /// eagerly.
9519
9521 public:
9523 : S(S), Enabled(Enabled) {
9524 if (!Enabled) return;
9525
9526 SavedPendingInstantiations.swap(S.PendingInstantiations);
9527 SavedVTableUses.swap(S.VTableUses);
9528 }
9529
9530 void perform() {
9531 if (Enabled) {
9532 S.DefineUsedVTables();
9533 S.PerformPendingInstantiations();
9534 }
9535 }
9536
9538 if (!Enabled) return;
9539
9540 // Restore the set of pending vtables.
9541 assert(S.VTableUses.empty() &&
9542 "VTableUses should be empty before it is discarded.");
9543 S.VTableUses.swap(SavedVTableUses);
9544
9545 // Restore the set of pending implicit instantiations.
9546 if (S.TUKind != TU_Prefix || !S.LangOpts.PCHInstantiateTemplates) {
9547 assert(S.PendingInstantiations.empty() &&
9548 "PendingInstantiations should be empty before it is discarded.");
9549 S.PendingInstantiations.swap(SavedPendingInstantiations);
9550 } else {
9551 // Template instantiations in the PCH may be delayed until the TU.
9552 S.PendingInstantiations.swap(SavedPendingInstantiations);
9553 S.PendingInstantiations.insert(S.PendingInstantiations.end(),
9554 SavedPendingInstantiations.begin(),
9555 SavedPendingInstantiations.end());
9556 }
9557 }
9558
9559 private:
9560 Sema &S;
9561 SmallVector<VTableUse, 16> SavedVTableUses;
9562 std::deque<PendingImplicitInstantiation> SavedPendingInstantiations;
9563 bool Enabled;
9564 };
9565
9566 /// The queue of implicit template instantiations that are required
9567 /// and must be performed within the current local scope.
9568 ///
9569 /// This queue is only used for member functions of local classes in
9570 /// templates, which must be instantiated in the same scope as their
9571 /// enclosing function, so that they can reference function-local
9572 /// types, static variables, enumerators, etc.
9573 std::deque<PendingImplicitInstantiation> PendingLocalImplicitInstantiations;
9574
9576 public:
9578 SavedPendingLocalImplicitInstantiations.swap(
9579 S.PendingLocalImplicitInstantiations);
9580 }
9581
9582 void perform() { S.PerformPendingInstantiations(/*LocalOnly=*/true); }
9583
9585 assert(S.PendingLocalImplicitInstantiations.empty() &&
9586 "there shouldn't be any pending local implicit instantiations");
9587 SavedPendingLocalImplicitInstantiations.swap(
9588 S.PendingLocalImplicitInstantiations);
9589 }
9590
9591 private:
9592 Sema &S;
9593 std::deque<PendingImplicitInstantiation>
9594 SavedPendingLocalImplicitInstantiations;
9595 };
9596
9597 /// A helper class for building up ExtParameterInfos.
9600 bool HasInteresting = false;
9601
9602 public:
9603 /// Set the ExtParameterInfo for the parameter at the given index,
9604 ///
9605 void set(unsigned index, FunctionProtoType::ExtParameterInfo info) {
9606 assert(Infos.size() <= index);
9607 Infos.resize(index);
9608 Infos.push_back(info);
9609
9610 if (!HasInteresting)
9611 HasInteresting = (info != FunctionProtoType::ExtParameterInfo());
9612 }
9613
9614 /// Return a pointer (suitable for setting in an ExtProtoInfo) to the
9615 /// ExtParameterInfo array we've built up.
9617 getPointerOrNull(unsigned numParams) {
9618 if (!HasInteresting) return nullptr;
9619 Infos.resize(numParams);
9620 return Infos.data();
9621 }
9622 };
9623
9624 void PerformPendingInstantiations(bool LocalOnly = false);
9625
9627 const MultiLevelTemplateArgumentList &TemplateArgs,
9628 SourceLocation Loc, DeclarationName Entity,
9629 bool AllowDeducedTST = false);
9630
9632 const MultiLevelTemplateArgumentList &TemplateArgs,
9633 SourceLocation Loc, DeclarationName Entity);
9634
9636 const MultiLevelTemplateArgumentList &TemplateArgs,
9637 SourceLocation Loc, DeclarationName Entity);
9638
9640 const MultiLevelTemplateArgumentList &TemplateArgs,
9641 SourceLocation Loc,
9642 DeclarationName Entity,
9643 CXXRecordDecl *ThisContext,
9644 Qualifiers ThisTypeQuals);
9645 void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto,
9646 const MultiLevelTemplateArgumentList &Args);
9649 SmallVectorImpl<QualType> &ExceptionStorage,
9650 const MultiLevelTemplateArgumentList &Args);
9652 const MultiLevelTemplateArgumentList &TemplateArgs,
9653 int indexAdjustment,
9654 Optional<unsigned> NumExpansions,
9655 bool ExpectParameterPack);
9657 const FunctionProtoType::ExtParameterInfo *ExtParamInfos,
9658 const MultiLevelTemplateArgumentList &TemplateArgs,
9659 SmallVectorImpl<QualType> &ParamTypes,
9661 ExtParameterInfoBuilder &ParamInfos);
9663 const MultiLevelTemplateArgumentList &TemplateArgs);
9664
9665 /// Substitute the given template arguments into a list of
9666 /// expressions, expanding pack expansions if required.
9667 ///
9668 /// \param Exprs The list of expressions to substitute into.
9669 ///
9670 /// \param IsCall Whether this is some form of call, in which case
9671 /// default arguments will be dropped.
9672 ///
9673 /// \param TemplateArgs The set of template arguments to substitute.
9674 ///
9675 /// \param Outputs Will receive all of the substituted arguments.
9676 ///
9677 /// \returns true if an error occurred, false otherwise.
9678 bool SubstExprs(ArrayRef<Expr *> Exprs, bool IsCall,
9679 const MultiLevelTemplateArgumentList &TemplateArgs,
9680 SmallVectorImpl<Expr *> &Outputs);
9681
9683 const MultiLevelTemplateArgumentList &TemplateArgs);
9684
9687 const MultiLevelTemplateArgumentList &TemplateArgs);
9688
9689 bool
9691 const MultiLevelTemplateArgumentList &TemplateArgs,
9692 TemplateArgumentListInfo &Outputs);
9693
9694
9695 Decl *SubstDecl(Decl *D, DeclContext *Owner,
9696 const MultiLevelTemplateArgumentList &TemplateArgs);
9697
9698 /// Substitute the name and return type of a defaulted 'operator<=>' to form
9699 /// an implicit 'operator=='.
9701 FunctionDecl *Spaceship);
9702
9704 const MultiLevelTemplateArgumentList &TemplateArgs,
9705 bool CXXDirectInit);
9706
9707 bool
9708 SubstBaseSpecifiers(CXXRecordDecl *Instantiation,
9709 CXXRecordDecl *Pattern,
9710 const MultiLevelTemplateArgumentList &TemplateArgs);
9711
9712 bool
9713 InstantiateClass(SourceLocation PointOfInstantiation,
9714 CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern,
9715 const MultiLevelTemplateArgumentList &TemplateArgs,
9717 bool Complain = true);
9718
9719 bool InstantiateEnum(SourceLocation PointOfInstantiation,
9720 EnumDecl *Instantiation, EnumDecl *Pattern,
9721 const MultiLevelTemplateArgumentList &TemplateArgs,
9723
9725 SourceLocation PointOfInstantiation, FieldDecl *Instantiation,
9726 FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs);
9727
9739
9740 void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs,
9741 const Decl *Pattern, Decl *Inst,
9742 LateInstantiatedAttrVec *LateAttrs = nullptr,
9743 LocalInstantiationScope *OuterMostScope = nullptr);
9744
9745 void
9747 const Decl *Pattern, Decl *Inst,
9748 LateInstantiatedAttrVec *LateAttrs = nullptr,
9749 LocalInstantiationScope *OuterMostScope = nullptr);
9750
9752
9754 SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec);
9755
9756 bool
9758 ClassTemplateSpecializationDecl *ClassTemplateSpec,
9760 bool Complain = true);
9761
9762 void InstantiateClassMembers(SourceLocation PointOfInstantiation,
9763 CXXRecordDecl *Instantiation,
9764 const MultiLevelTemplateArgumentList &TemplateArgs,
9766
9768 SourceLocation PointOfInstantiation,
9769 ClassTemplateSpecializationDecl *ClassTemplateSpec,
9771
9774 const MultiLevelTemplateArgumentList &TemplateArgs);
9775
9778 const MultiLevelTemplateArgumentList &TemplateArgs);
9781 SourceLocation Loc,
9782 const MultiLevelTemplateArgumentList &TemplateArgs);
9783
9785 const MultiLevelTemplateArgumentList &TemplateArgs);
9786
9788 ParmVarDecl *Param);
9789 void InstantiateExceptionSpec(SourceLocation PointOfInstantiation,
9790 FunctionDecl *Function);
9792 SourceLocation PointOfInstantiation, FunctionDecl *Decl,
9793 ArrayRef<TemplateArgument> TemplateArgs,
9794 ConstraintSatisfaction &Satisfaction);
9796 const TemplateArgumentList *Args,
9797 SourceLocation Loc);
9798 void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
9799 FunctionDecl *Function,
9800 bool Recursive = false,
9801 bool DefinitionRequired = false,
9802 bool AtEndOfTU = false);
9805 const TemplateArgumentList &TemplateArgList,
9806 const TemplateArgumentListInfo &TemplateArgsInfo,
9808 SourceLocation PointOfInstantiation,
9809 LateInstantiatedAttrVec *LateAttrs = nullptr,
9810 LocalInstantiationScope *StartingScope = nullptr);
9812 VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl,
9813 const MultiLevelTemplateArgumentList &TemplateArgs);
9814 void
9816 const MultiLevelTemplateArgumentList &TemplateArgs,
9817 LateInstantiatedAttrVec *LateAttrs,
9818 DeclContext *Owner,
9819 LocalInstantiationScope *StartingScope,
9820 bool InstantiatingVarTemplate = false,
9821 VarTemplateSpecializationDecl *PrevVTSD = nullptr);
9822
9824 VarDecl *Var, VarDecl *OldVar,
9825 const MultiLevelTemplateArgumentList &TemplateArgs);
9826 void InstantiateVariableDefinition(SourceLocation PointOfInstantiation,
9827 VarDecl *Var, bool Recursive = false,
9828 bool DefinitionRequired = false,
9829 bool AtEndOfTU = false);
9830
9832 const CXXConstructorDecl *Tmpl,
9833 const MultiLevelTemplateArgumentList &TemplateArgs);
9834
9836 const MultiLevelTemplateArgumentList &TemplateArgs,
9837 bool FindingInstantiatedContext = false);
9839 const MultiLevelTemplateArgumentList &TemplateArgs);
9840
9841 // Objective-C declarations.
9852
9854 ObjCTypeParamVariance variance,
9855 SourceLocation varianceLoc,
9856 unsigned index,
9857 IdentifierInfo *paramName,
9858 SourceLocation paramLoc,
9859 SourceLocation colonLoc,
9860 ParsedType typeBound);
9861
9863 ArrayRef<Decl *> typeParams,
9864 SourceLocation rAngleLoc);
9865 void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList);
9866
9868 Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
9869 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
9870 IdentifierInfo *SuperName, SourceLocation SuperLoc,
9871 ArrayRef<ParsedType> SuperTypeArgs, SourceRange SuperTypeArgsRange,
9872 Decl *const *ProtoRefs, unsigned NumProtoRefs,
9873 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
9874 const ParsedAttributesView &AttrList);
9875
9877 SourceLocation AtInterfaceLoc,
9878 ObjCInterfaceDecl *IDecl,
9879 IdentifierInfo *ClassName,
9880 SourceLocation ClassLoc,
9881 IdentifierInfo *SuperName,
9882 SourceLocation SuperLoc,
9883 ArrayRef<ParsedType> SuperTypeArgs,
9884 SourceRange SuperTypeArgsRange);
9885
9887 SmallVectorImpl<SourceLocation> &ProtocolLocs,
9888 IdentifierInfo *SuperName,
9889 SourceLocation SuperLoc);
9890
9892 SourceLocation AtCompatibilityAliasLoc,
9893 IdentifierInfo *AliasName, SourceLocation AliasLocation,
9894 IdentifierInfo *ClassName, SourceLocation ClassLocation);
9895
9897 IdentifierInfo *PName,
9898 SourceLocation &PLoc, SourceLocation PrevLoc,
9899 const ObjCList<ObjCProtocolDecl> &PList);
9900
9902 SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName,
9903 SourceLocation ProtocolLoc, Decl *const *ProtoRefNames,
9904 unsigned NumProtoRefs, const SourceLocation *ProtoLocs,
9905 SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList);
9906
9908 SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName,
9909 SourceLocation ClassLoc, ObjCTypeParamList *typeParamList,
9910 IdentifierInfo *CategoryName, SourceLocation CategoryLoc,
9911 Decl *const *ProtoRefs, unsigned NumProtoRefs,
9912 const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc,
9913 const ParsedAttributesView &AttrList);
9914
9916 SourceLocation AtClassImplLoc, IdentifierInfo *ClassName,
9917 SourceLocation ClassLoc, IdentifierInfo *SuperClassname,
9918 SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList);
9919
9921 SourceLocation AtCatImplLoc, IdentifierInfo *ClassName,
9922 SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc,
9923 const ParsedAttributesView &AttrList);
9924
9926 ArrayRef<Decl *> Decls);
9927
9929 IdentifierInfo **IdentList,
9930 SourceLocation *IdentLocs,
9931 ArrayRef<ObjCTypeParamList *> TypeParamLists,
9932 unsigned NumElts);
9933
9937 const ParsedAttributesView &attrList);
9938
9939 void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer,
9940 ArrayRef<IdentifierLocPair> ProtocolId,
9941 SmallVectorImpl<Decl *> &Protocols);
9942
9944 SourceLocation ProtocolLoc,
9945 IdentifierInfo *TypeArgId,
9946 SourceLocation TypeArgLoc,
9947 bool SelectProtocolFirst = false);
9948
9949 /// Given a list of identifiers (and their locations), resolve the
9950 /// names to either Objective-C protocol qualifiers or type
9951 /// arguments, as appropriate.
9953 Scope *S,
9954 ParsedType baseType,
9955 SourceLocation lAngleLoc,
9956 ArrayRef<IdentifierInfo *> identifiers,
9957 ArrayRef<SourceLocation> identifierLocs,
9958 SourceLocation rAngleLoc,
9959 SourceLocation &typeArgsLAngleLoc,
9961 SourceLocation &typeArgsRAngleLoc,
9962 SourceLocation &protocolLAngleLoc,
9963 SmallVectorImpl<Decl *> &protocols,
9964 SourceLocation &protocolRAngleLoc,
9965 bool warnOnIncompleteProtocols);
9966
9967 /// Build a an Objective-C protocol-qualified 'id' type where no
9968 /// base type was specified.
9970 SourceLocation lAngleLoc,
9971 ArrayRef<Decl *> protocols,
9972 ArrayRef<SourceLocation> protocolLocs,
9973 SourceLocation rAngleLoc);
9974
9975 /// Build a specialized and/or protocol-qualified Objective-C type.
9977 Scope *S,
9978 SourceLocation Loc,
9979 ParsedType BaseType,
9980 SourceLocation TypeArgsLAngleLoc,
9981 ArrayRef<ParsedType> TypeArgs,
9982 SourceLocation TypeArgsRAngleLoc,
9983 SourceLocation ProtocolLAngleLoc,
9984 ArrayRef<Decl *> Protocols,
9985 ArrayRef<SourceLocation> ProtocolLocs,
9986 SourceLocation ProtocolRAngleLoc);
9987
9988 /// Build an Objective-C type parameter type.
9990 SourceLocation ProtocolLAngleLoc,
9992 ArrayRef<SourceLocation> ProtocolLocs,
9993 SourceLocation ProtocolRAngleLoc,
9994 bool FailOnError = false);
9995
9996 /// Build an Objective-C object pointer type.
9998 SourceLocation Loc,
9999 SourceLocation TypeArgsLAngleLoc,
10001 SourceLocation TypeArgsRAngleLoc,
10002 SourceLocation ProtocolLAngleLoc,
10004 ArrayRef<SourceLocation> ProtocolLocs,
10005 SourceLocation ProtocolRAngleLoc,
10006 bool FailOnError = false);
10007
10008 /// Ensure attributes are consistent with type.
10009 /// \param [in, out] Attributes The attributes to check; they will
10010 /// be modified to be consistent with \p PropertyTy.
10011 void CheckObjCPropertyAttributes(Decl *PropertyPtrTy,
10012 SourceLocation Loc,
10013 unsigned &Attributes,
10014 bool propertyInPrimaryClass);
10015
10016 /// Process the specified property declaration and create decls for the
10017 /// setters and getters as needed.
10018 /// \param property The property declaration being processed
10019 void ProcessPropertyDecl(ObjCPropertyDecl *property);
10020
10021
10023 ObjCPropertyDecl *SuperProperty,
10024 const IdentifierInfo *Name,
10025 bool OverridingProtocolProperty);
10026
10028 ObjCInterfaceDecl *ID);
10029
10030 Decl *ActOnAtEnd(Scope *S, SourceRange AtEnd,
10031 ArrayRef<Decl *> allMethods = None,
10032 ArrayRef<DeclGroupPtrTy> allTUVars = None);
10033
10035 SourceLocation LParenLoc,
10036 FieldDeclarator &FD, ObjCDeclSpec &ODS,
10037 Selector GetterSel, Selector SetterSel,
10038 tok::ObjCKeywordKind MethodImplKind,
10039 DeclContext *lexicalDC = nullptr);
10040
10042 SourceLocation AtLoc,
10043 SourceLocation PropertyLoc,
10044 bool ImplKind,
10045 IdentifierInfo *PropertyId,
10046 IdentifierInfo *PropertyIvar,
10047 SourceLocation PropertyIvarLoc,
10048 ObjCPropertyQueryKind QueryKind);
10049
10058
10062 // The Type is null if no type was specified, and the DeclSpec is invalid
10063 // in this case.
10066
10067 /// ArgAttrs - Attribute list for this argument.
10069 };
10070
10072 Scope *S,
10073 SourceLocation BeginLoc, // location of the + or -.
10074 SourceLocation EndLoc, // location of the ; or {.
10075 tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
10076 ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
10077 // optional arguments. The number of types/arguments is obtained
10078 // from the Sel.getNumArgs().
10079 ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo,
10080 unsigned CNumArgs, // c-style args
10081 const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind,
10082 bool isVariadic, bool MethodDefinition);
10083
10085 const ObjCObjectPointerType *OPT,
10086 bool IsInstance);
10088 bool IsInstance);
10089
10090 bool CheckARCMethodDecl(ObjCMethodDecl *method);
10092
10094
10097 Expr *BaseExpr,
10098 SourceLocation OpLoc,
10099 DeclarationName MemberName,
10100 SourceLocation MemberLoc,
10101 SourceLocation SuperLoc, QualType SuperType,
10102 bool Super);
10103
10106 IdentifierInfo &propertyName,
10107 SourceLocation receiverNameLoc,
10108 SourceLocation propertyNameLoc);
10109
10111
10112 /// Describes the kind of message expression indicated by a message
10113 /// send that starts with an identifier.
10115 /// The message is sent to 'super'.
10117 /// The message is an instance message.
10119 /// The message is a class message, and the identifier is a type
10120 /// name.
10123
10125 IdentifierInfo *Name,
10126 SourceLocation NameLoc,
10127 bool IsSuper,
10128 bool HasTrailingDot,
10129 ParsedType &ReceiverType);
10130
10132 Selector Sel,
10133 SourceLocation LBracLoc,
10134 ArrayRef<SourceLocation> SelectorLocs,
10135 SourceLocation RBracLoc,
10136 MultiExprArg Args);
10137
10139 QualType ReceiverType,
10140 SourceLocation SuperLoc,
10141 Selector Sel,
10142 ObjCMethodDecl *Method,
10143 SourceLocation LBracLoc,
10144 ArrayRef<SourceLocation> SelectorLocs,
10145 SourceLocation RBracLoc,
10146 MultiExprArg Args,
10147 bool isImplicit = false);
10148
10150 bool isSuperReceiver,
10151 SourceLocation Loc,
10152 Selector Sel,
10153 ObjCMethodDecl *Method,
10154 MultiExprArg Args);
10155
10157 ParsedType Receiver,
10158 Selector Sel,
10159 SourceLocation LBracLoc,
10160 ArrayRef<SourceLocation> SelectorLocs,
10161 SourceLocation RBracLoc,
10162 MultiExprArg Args);
10163
10165 QualType ReceiverType,
10166 SourceLocation SuperLoc,
10167 Selector Sel,
10168 ObjCMethodDecl *Method,
10169 SourceLocation LBracLoc,
10170 ArrayRef<SourceLocation> SelectorLocs,
10171 SourceLocation RBracLoc,
10172 MultiExprArg Args,
10173 bool isImplicit = false);
10174
10176 QualType ReceiverType,
10177 SourceLocation Loc,
10178 Selector Sel,
10179 ObjCMethodDecl *Method,
10180 MultiExprArg Args);
10181
10183 Expr *Receiver,
10184 Selector Sel,
10185 SourceLocation LBracLoc,
10186 ArrayRef<SourceLocation> SelectorLocs,
10187 SourceLocation RBracLoc,
10188 MultiExprArg Args);
10189
10191 ObjCBridgeCastKind Kind,
10192 SourceLocation BridgeKeywordLoc,
10193 TypeSourceInfo *TSInfo,
10194 Expr *SubExpr);
10195
10197 SourceLocation LParenLoc,
10198 ObjCBridgeCastKind Kind,
10199 SourceLocation BridgeKeywordLoc,
10201 SourceLocation RParenLoc,
10202 Expr *SubExpr);
10203
10205
10207
10209 CastKind &Kind);
10210
10212 QualType DestType, QualType SrcType,
10213 ObjCInterfaceDecl *&RelatedClass,
10214 ObjCMethodDecl *&ClassMethod,
10215 ObjCMethodDecl *&InstanceMethod,
10216 TypedefNameDecl *&TDNDecl,
10217 bool CfToNs, bool Diagnose = true);
10218
10220 QualType DestType, QualType SrcType,
10221 Expr *&SrcExpr, bool Diagnose = true);
10222
10223 bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr,
10224 bool Diagnose = true);
10225
10226 bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall);
10227
10228 /// Check whether the given new method is a valid override of the
10229 /// given overridden method, and set any properties that should be inherited.
10231 const ObjCMethodDecl *Overridden);
10232
10233 /// Describes the compatibility of a result type with its method.
10239
10241 ObjCMethodDecl *overridden);
10242
10244 ObjCInterfaceDecl *CurrentClass,
10246
10248 POAK_Native, // #pragma options align=native
10249 POAK_Natural, // #pragma options align=natural
10250 POAK_Packed, // #pragma options align=packed
10251 POAK_Power, // #pragma options align=power
10252 POAK_Mac68k, // #pragma options align=mac68k
10253 POAK_Reset // #pragma options align=reset
10255
10256 /// ActOnPragmaClangSection - Called on well formed \#pragma clang section
10259 PragmaClangSectionKind SecKind, StringRef SecName);
10260
10261 /// ActOnPragmaOptionsAlign - Called on well formed \#pragma options align.
10263 SourceLocation PragmaLoc);
10264
10265 /// ActOnPragmaPack - Called on well formed \#pragma pack(...).
10266 void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action,
10267 StringRef SlotLabel, Expr *Alignment);
10268
10273
10275 SourceLocation IncludeLoc);
10277
10278 /// ActOnPragmaMSStruct - Called on well formed \#pragma ms_struct [on|off].
10280
10281 /// ActOnPragmaMSComment - Called on well formed
10282 /// \#pragma comment(kind, "arg").
10284 StringRef Arg);
10285
10286 /// ActOnPragmaMSPointersToMembers - called on well formed \#pragma
10287 /// pointers_to_members(representation method[, general purpose
10288 /// representation]).
10291 SourceLocation PragmaLoc);
10292
10293 /// Called on well formed \#pragma vtordisp().
10295 SourceLocation PragmaLoc,
10297
10304
10305 bool UnifySection(StringRef SectionName, int SectionFlags,
10306 NamedDecl *TheDecl);
10307 bool UnifySection(StringRef SectionName,
10308 int SectionFlags,
10309 SourceLocation PragmaSectionLocation);
10310
10311 /// Called on well formed \#pragma bss_seg/data_seg/const_seg/code_seg.
10312 void ActOnPragmaMSSeg(SourceLocation PragmaLocation,
10313 PragmaMsStackAction Action,
10314 llvm::StringRef StackSlotLabel,
10315 StringLiteral *SegmentName,
10316 llvm::StringRef PragmaName);
10317
10318 /// Called on well formed \#pragma section().
10319 void ActOnPragmaMSSection(SourceLocation PragmaLocation,
10320 int SectionFlags, StringLiteral *SegmentName);
10321
10322 /// Called on well-formed \#pragma init_seg().
10323 void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation,
10324 StringLiteral *SegmentName);
10325
10326 /// Called on well-formed \#pragma alloc_text().
10328 SourceLocation PragmaLocation, StringRef Section,
10329 const SmallVector<std::tuple<IdentifierInfo *, SourceLocation>>
10330 &Functions);
10331
10332 /// Called on #pragma clang __debug dump II
10334
10335 /// ActOnPragmaDetectMismatch - Call on well-formed \#pragma detect_mismatch
10336 void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name,
10337 StringRef Value);
10338
10339 /// Are precise floating point semantics currently enabled?
10341 return !CurFPFeatures.getAllowFPReassociate() &&
10342 !CurFPFeatures.getNoSignedZero() &&
10343 !CurFPFeatures.getAllowReciprocal() &&
10344 !CurFPFeatures.getAllowApproxFunc();
10345 }
10346
10349
10350 /// ActOnPragmaFloatControl - Call on well-formed \#pragma float_control
10353
10354 /// ActOnPragmaUnused - Called on well-formed '\#pragma unused'.
10356 Scope *curScope,
10357 SourceLocation PragmaLoc);
10358
10359 /// ActOnPragmaVisibility - Called on well formed \#pragma GCC visibility... .
10360 void ActOnPragmaVisibility(const IdentifierInfo* VisType,
10361 SourceLocation PragmaLoc);
10362
10364 SourceLocation Loc);
10365 void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W);
10366
10367 /// ActOnPragmaWeakID - Called on well formed \#pragma weak ident.
10368 void ActOnPragmaWeakID(IdentifierInfo* WeakName,
10369 SourceLocation PragmaLoc,
10370 SourceLocation WeakNameLoc);
10371
10372 /// ActOnPragmaRedefineExtname - Called on well formed
10373 /// \#pragma redefine_extname oldname newname.
10375 IdentifierInfo* AliasName,
10376 SourceLocation PragmaLoc,
10377 SourceLocation WeakNameLoc,
10378 SourceLocation AliasNameLoc);
10379
10380 /// ActOnPragmaWeakAlias - Called on well formed \#pragma weak ident = ident.
10381 void ActOnPragmaWeakAlias(IdentifierInfo* WeakName,
10382 IdentifierInfo* AliasName,
10383 SourceLocation PragmaLoc,
10384 SourceLocation WeakNameLoc,
10385 SourceLocation AliasNameLoc);
10386
10387 /// ActOnPragmaFPContract - Called on well formed
10388 /// \#pragma {STDC,OPENCL} FP_CONTRACT and
10389 /// \#pragma clang fp contract
10391
10392 /// Called on well formed
10393 /// \#pragma clang fp reassociate
10394 void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled);
10395
10396 /// ActOnPragmaFenvAccess - Called on well formed
10397 /// \#pragma STDC FENV_ACCESS
10398 void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled);
10399
10400 /// Called on well formed '\#pragma clang fp' that has option 'exceptions'.
10403
10404 /// Called to set constant rounding mode for floating point operations.
10405 void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode);
10406
10407 /// Called to set exception behavior for floating point operations.
10409
10410 /// AddAlignmentAttributesForRecord - Adds any needed alignment attributes to
10411 /// a the record decl, to handle '\#pragma pack' and '\#pragma options align'.
10413
10414 /// AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
10416
10417 /// PushNamespaceVisibilityAttr - Note that we've entered a
10418 /// namespace with a visibility attribute.
10419 void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr,
10420 SourceLocation Loc);
10421
10422 /// AddPushedVisibilityAttribute - If '\#pragma GCC visibility' was used,
10423 /// add an appropriate visibility attribute.
10425
10426 /// PopPragmaVisibility - Pop the top element of the visibility stack; used
10427 /// for '\#pragma GCC visibility' and visibility attributes on namespaces.
10428 void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc);
10429
10430 /// FreeVisContext - Deallocate and null out VisContext.
10431 void FreeVisContext();
10432
10433 /// AddCFAuditedAttribute - Check whether we're currently within
10434 /// '\#pragma clang arc_cf_code_audited' and, if so, consider adding
10435 /// the appropriate attribute.
10436 void AddCFAuditedAttribute(Decl *D);
10437
10439 SourceLocation PragmaLoc,
10442 const IdentifierInfo *Namespace);
10443
10444 /// Called on well-formed '\#pragma clang attribute pop'.
10446 const IdentifierInfo *Namespace);
10447
10448 /// Adds the attributes that have been specified using the
10449 /// '\#pragma clang attribute push' directives to the given declaration.
10450 void AddPragmaAttributes(Scope *S, Decl *D);
10451
10453
10454 /// Called on well formed \#pragma clang optimize.
10455 void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc);
10456
10457 /// #pragma optimize("[optimization-list]", on | off).
10458 void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn);
10459
10460 /// Call on well formed \#pragma function.
10461 void
10463 const llvm::SmallVectorImpl<StringRef> &NoBuiltins);
10464
10465 /// Get the location for the currently active "\#pragma clang optimize
10466 /// off". If this location is invalid, then the state of the pragma is "on".
10470
10471 /// Only called on function definitions; if there is a pragma in scope
10472 /// with the effect of a range-based optnone, consider marking the function
10473 /// with attribute optnone.
10475
10476 /// Only called on function definitions; if there is a `#pragma alloc_text`
10477 /// that decides which code section the function should be in, add
10478 /// attribute section to the function.
10480
10481 /// Adds the 'optnone' attribute to the function declaration if there
10482 /// are no conflicts; Loc represents the location causing the 'optnone'
10483 /// attribute to be added (usually because of a pragma).
10485
10486 /// Only called on function definitions; if there is a MSVC #pragma optimize
10487 /// in scope, consider changing the function's attributes based on the
10488 /// optimization list passed to the pragma.
10490
10491 /// Only called on function definitions; if there is a pragma in scope
10492 /// with the effect of a range-based no_builtin, consider marking the function
10493 /// with attribute no_builtin.
10495
10496 /// AddAlignedAttr - Adds an aligned attribute to a particular declaration.
10497 void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
10498 bool IsPackExpansion);
10500 bool IsPackExpansion);
10501
10502 /// AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular
10503 /// declaration.
10504 void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E,
10505 Expr *OE);
10506
10507 /// AddAllocAlignAttr - Adds an alloc_align attribute to a particular
10508 /// declaration.
10509 void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI,
10510 Expr *ParamExpr);
10511
10512 /// AddAlignValueAttr - Adds an align_value attribute to a particular
10513 /// declaration.
10514 void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E);
10515
10516 /// AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
10517 void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI,
10518 StringRef Annot, MutableArrayRef<Expr *> Args);
10519
10520 /// ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs
10521 /// (unless they are value dependent or type dependent). Returns false
10522 /// and emits a diagnostic if one or more of the arguments could not be
10523 /// folded into a constant.
10526
10527 /// AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular
10528 /// declaration.
10529 void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI,
10530 Expr *MaxThreads, Expr *MinBlocks);
10531
10532 /// AddModeAttr - Adds a mode attribute to a particular declaration.
10533 void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name,
10534 bool InInstantiation = false);
10535
10536 void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI,
10537 ParameterABI ABI);
10538
10539 enum class RetainOwnershipKind {NS, CF, OS};
10540 void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI,
10541 RetainOwnershipKind K, bool IsTemplateInstantiation);
10542
10543 /// addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size
10544 /// attribute to a particular declaration.
10546 Expr *Min, Expr *Max);
10547
10548 /// addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a
10549 /// particular declaration.
10551 Expr *Min, Expr *Max);
10552
10554
10555 //===--------------------------------------------------------------------===//
10556 // C++ Coroutines TS
10557 //
10559 StringRef Keyword);
10563
10566 UnresolvedLookupExpr *Lookup);
10568 Expr *Awaiter, bool IsImplicit = false);
10570 UnresolvedLookupExpr *Lookup);
10573 bool IsImplicit = false);
10578 /// Lookup 'coroutine_traits' in std namespace and std::experimental
10579 /// namespace. The namespace found is recorded in Namespace.
10581 SourceLocation FuncLoc,
10582 NamespaceDecl *&Namespace);
10583 /// Check that the expression co_await promise.final_suspend() shall not be
10584 /// potentially-throwing.
10585 bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
10586
10587 //===--------------------------------------------------------------------===//
10588 // OpenMP directives and clauses.
10589 //
10590private:
10591 void *VarDataSharingAttributesStack;
10592
10593 struct DeclareTargetContextInfo {
10594 struct MapInfo {
10595 OMPDeclareTargetDeclAttr::MapTypeTy MT;
10597 };
10598 /// Explicitly listed variables and functions in a 'to' or 'link' clause.
10599 llvm::DenseMap<NamedDecl *, MapInfo> ExplicitlyMapped;
10600
10601 /// The 'device_type' as parsed from the clause.
10602 OMPDeclareTargetDeclAttr::DevTypeTy DT = OMPDeclareTargetDeclAttr::DT_Any;
10603
10604 /// The directive kind, `begin declare target` or `declare target`.
10606
10607 /// The directive with indirect clause.
10608 Optional<Expr *> Indirect;
10609
10610 /// The directive location.
10611 SourceLocation Loc;
10612
10613 DeclareTargetContextInfo(OpenMPDirectiveKind Kind, SourceLocation Loc)
10614 : Kind(Kind), Loc(Loc) {}
10615 };
10616
10617 /// Number of nested '#pragma omp declare target' directives.
10618 SmallVector<DeclareTargetContextInfo, 4> DeclareTargetNesting;
10619
10620 /// Initialization of data-sharing attributes stack.
10621 void InitDataSharingAttributesStack();
10622 void DestroyDataSharingAttributesStack();
10624 VerifyPositiveIntegerConstantInClause(Expr *Op, OpenMPClauseKind CKind,
10625 bool StrictlyPositive = true,
10626 bool SuppressExprDiags = false);
10627 /// Returns OpenMP nesting level for current directive.
10628 unsigned getOpenMPNestingLevel() const;
10629
10630 /// Adjusts the function scopes index for the target-based regions.
10631 void adjustOpenMPTargetScopeIndex(unsigned &FunctionScopesIndex,
10632 unsigned Level) const;
10633
10634 /// Returns the number of scopes associated with the construct on the given
10635 /// OpenMP level.
10636 int getNumberOfConstructScopes(unsigned Level) const;
10637
10638 /// Push new OpenMP function region for non-capturing function.
10639 void pushOpenMPFunctionRegion();
10640
10641 /// Pop OpenMP function region for non-capturing function.
10642 void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
10643
10644 /// Analyzes and checks a loop nest for use by a loop transformation.
10645 ///
10646 /// \param Kind The loop transformation directive kind.
10647 /// \param NumLoops How many nested loops the directive is expecting.
10648 /// \param AStmt Associated statement of the transformation directive.
10649 /// \param LoopHelpers [out] The loop analysis result.
10650 /// \param Body [out] The body code nested in \p NumLoops loop.
10651 /// \param OriginalInits [out] Collection of statements and declarations that
10652 /// must have been executed/declared before entering the
10653 /// loop.
10654 ///
10655 /// \return Whether there was any error.
10656 bool checkTransformableLoopNest(
10657 OpenMPDirectiveKind Kind, Stmt *AStmt, int NumLoops,
10659 Stmt *&Body,
10660 SmallVectorImpl<SmallVector<llvm::PointerUnion<Stmt *, Decl *>, 0>>
10661 &OriginalInits);
10662
10663 /// Helper to keep information about the current `omp begin/end declare
10664 /// variant` nesting.
10665 struct OMPDeclareVariantScope {
10666 /// The associated OpenMP context selector.
10667 OMPTraitInfo *TI;
10668
10669 /// The associated OpenMP context selector mangling.
10670 std::string NameSuffix;
10671
10672 OMPDeclareVariantScope(OMPTraitInfo &TI);
10673 };
10674
10675 /// Return the OMPTraitInfo for the surrounding scope, if any.
10676 OMPTraitInfo *getOMPTraitInfoForSurroundingScope() {
10677 return OMPDeclareVariantScopes.empty() ? nullptr
10678 : OMPDeclareVariantScopes.back().TI;
10679 }
10680
10681 /// The current `omp begin/end declare variant` scopes.
10682 SmallVector<OMPDeclareVariantScope, 4> OMPDeclareVariantScopes;
10683
10684 /// The current `omp begin/end assumes` scopes.
10685 SmallVector<AssumptionAttr *, 4> OMPAssumeScoped;
10686
10687 /// All `omp assumes` we encountered so far.
10688 SmallVector<AssumptionAttr *, 4> OMPAssumeGlobal;
10689
10690public:
10691 /// The declarator \p D defines a function in the scope \p S which is nested
10692 /// in an `omp begin/end declare variant` scope. In this method we create a
10693 /// declaration for \p D and rename \p D according to the OpenMP context
10694 /// selector of the surrounding scope. Return all base functions in \p Bases.
10696 Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists,
10697 SmallVectorImpl<FunctionDecl *> &Bases);
10698
10699 /// Register \p D as specialization of all base functions in \p Bases in the
10700 /// current `omp begin/end declare variant` scope.
10702 Decl *D, SmallVectorImpl<FunctionDecl *> &Bases);
10703
10704 /// Act on \p D, a function definition inside of an `omp [begin/end] assumes`.
10706
10707 /// Can we exit an OpenMP declare variant scope at the moment.
10709 return !OMPDeclareVariantScopes.empty();
10710 }
10711
10712 /// Given the potential call expression \p Call, determine if there is a
10713 /// specialization via the OpenMP declare variant mechanism available. If
10714 /// there is, return the specialized call expression, otherwise return the
10715 /// original \p Call.
10717 SourceLocation LParenLoc, MultiExprArg ArgExprs,
10718 SourceLocation RParenLoc, Expr *ExecConfig);
10719
10720 /// Handle a `omp begin declare variant`.
10722
10723 /// Handle a `omp end declare variant`.
10725
10726 /// Checks if the variant/multiversion functions are compatible.
10728 const FunctionDecl *OldFD, const FunctionDecl *NewFD,
10729 const PartialDiagnostic &NoProtoDiagID,
10730 const PartialDiagnosticAt &NoteCausedDiagIDAt,
10731 const PartialDiagnosticAt &NoSupportDiagIDAt,
10732 const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported,
10733 bool ConstexprSupported, bool CLinkageMayDiffer);
10734
10735 /// Function tries to capture lambda's captured variables in the OpenMP region
10736 /// before the original lambda is captured.
10738
10739 /// Return true if the provided declaration \a VD should be captured by
10740 /// reference.
10741 /// \param Level Relative level of nested OpenMP construct for that the check
10742 /// is performed.
10743 /// \param OpenMPCaptureLevel Capture level within an OpenMP construct.
10744 bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level,
10745 unsigned OpenMPCaptureLevel) const;
10746
10747 /// Check if the specified variable is used in one of the private
10748 /// clauses (private, firstprivate, lastprivate, reduction etc.) in OpenMP
10749 /// constructs.
10750 VarDecl *isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo = false,
10751 unsigned StopAt = 0);
10752
10753 /// The member expression(this->fd) needs to be rebuilt in the template
10754 /// instantiation to generate private copy for OpenMP when default
10755 /// clause is used. The function will return true if default
10756 /// cluse is used.
10758
10761
10762 /// If the current region is a loop-based region, mark the start of the loop
10763 /// construct.
10764 void startOpenMPLoop();
10765
10766 /// If the current region is a range loop-based region, mark the start of the
10767 /// loop construct.
10769
10770 /// Check if the specified variable is used in 'private' clause.
10771 /// \param Level Relative level of nested OpenMP construct for that the check
10772 /// is performed.
10774 unsigned CapLevel) const;
10775
10776 /// Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.)
10777 /// for \p FD based on DSA for the provided corresponding captured declaration
10778 /// \p D.
10779 void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level);
10780
10781 /// Check if the specified variable is captured by 'target' directive.
10782 /// \param Level Relative level of nested OpenMP construct for that the check
10783 /// is performed.
10784 bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level,
10785 unsigned CaptureLevel) const;
10786
10787 /// Check if the specified global variable must be captured by outer capture
10788 /// regions.
10789 /// \param Level Relative level of nested OpenMP construct for that
10790 /// the check is performed.
10791 bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level,
10792 unsigned CaptureLevel) const;
10793
10795 Expr *Op);
10796 /// Called on start of new data sharing attribute block.
10798 const DeclarationNameInfo &DirName, Scope *CurScope,
10799 SourceLocation Loc);
10800 /// Start analysis of clauses.
10802 /// End analysis of clauses.
10803 void EndOpenMPClause();
10804 /// Called on end of data sharing attribute block.
10805 void EndOpenMPDSABlock(Stmt *CurDirective);
10806
10807 /// Check if the current region is an OpenMP loop region and if it is,
10808 /// mark loop control variable, used in \p Init for loop initialization, as
10809 /// private by default.
10810 /// \param Init First part of the for loop.
10812
10813 /// Called on well-formed '\#pragma omp metadirective' after parsing
10814 /// of the associated statement.
10816 Stmt *AStmt, SourceLocation StartLoc,
10817 SourceLocation EndLoc);
10818
10819 // OpenMP directives and clauses.
10820 /// Called on correct id-expression from the '#pragma omp
10821 /// threadprivate'.
10823 const DeclarationNameInfo &Id,
10824 OpenMPDirectiveKind Kind);
10825 /// Called on well-formed '#pragma omp threadprivate'.
10827 SourceLocation Loc,
10828 ArrayRef<Expr *> VarList);
10829 /// Builds a new OpenMPThreadPrivateDecl and checks its correctness.
10831 ArrayRef<Expr *> VarList);
10832 /// Called on well-formed '#pragma omp allocate'.
10834 ArrayRef<Expr *> VarList,
10835 ArrayRef<OMPClause *> Clauses,
10836 DeclContext *Owner = nullptr);
10837
10838 /// Called on well-formed '#pragma omp [begin] assume[s]'.
10840 OpenMPDirectiveKind DKind,
10841 ArrayRef<std::string> Assumptions,
10842 bool SkippedClauses);
10843
10844 /// Check if there is an active global `omp begin assumes` directive.
10845 bool isInOpenMPAssumeScope() const { return !OMPAssumeScoped.empty(); }
10846
10847 /// Check if there is an active global `omp assumes` directive.
10848 bool hasGlobalOpenMPAssumes() const { return !OMPAssumeGlobal.empty(); }
10849
10850 /// Called on well-formed '#pragma omp end assumes'.
10852
10853 /// Called on well-formed '#pragma omp requires'.
10855 ArrayRef<OMPClause *> ClauseList);
10856 /// Check restrictions on Requires directive
10858 ArrayRef<OMPClause *> Clauses);
10859 /// Check if the specified type is allowed to be used in 'omp declare
10860 /// reduction' construct.
10863 /// Called on start of '#pragma omp declare reduction'.
10865 Scope *S, DeclContext *DC, DeclarationName Name,
10866 ArrayRef<std::pair<QualType, SourceLocation>> ReductionTypes,
10867 AccessSpecifier AS, Decl *PrevDeclInScope = nullptr);
10868 /// Initialize declare reduction construct initializer.
10870 /// Finish current declare reduction construct initializer.
10872 /// Initialize declare reduction construct initializer.
10873 /// \return omp_priv variable.
10875 /// Finish current declare reduction construct initializer.
10877 VarDecl *OmpPrivParm);
10878 /// Called at the end of '#pragma omp declare reduction'.
10880 Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid);
10881
10882 /// Check variable declaration in 'omp declare mapper' construct.
10884 /// Check if the specified type is allowed to be used in 'omp declare
10885 /// mapper' construct.
10888 /// Called on start of '#pragma omp declare mapper'.
10890 Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType,
10892 Expr *MapperVarRef, ArrayRef<OMPClause *> Clauses,
10893 Decl *PrevDeclInScope = nullptr);
10894 /// Build the mapper variable of '#pragma omp declare mapper'.
10896 QualType MapperType,
10897 SourceLocation StartLoc,
10898 DeclarationName VN);
10899 bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const;
10901
10902 /// Called on the start of target region i.e. '#pragma omp declare target'.
10903 bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
10904
10905 /// Called at the end of target region i.e. '#pragma omp end declare target'.
10906 const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective();
10907
10908 /// Called once a target context is completed, that can be when a
10909 /// '#pragma omp end declare target' was encountered or when a
10910 /// '#pragma omp declare target' without declaration-definition-seq was
10911 /// encountered.
10912 void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI);
10913
10914 /// Report unterminated 'omp declare target' or 'omp begin declare target' at
10915 /// the end of a compilation unit.
10917
10918 /// Searches for the provided declaration name for OpenMP declare target
10919 /// directive.
10921 CXXScopeSpec &ScopeSpec,
10922 const DeclarationNameInfo &Id);
10923
10924 /// Called on correct id-expression from the '#pragma omp declare target'.
10926 OMPDeclareTargetDeclAttr::MapTypeTy MT,
10927 DeclareTargetContextInfo &DTCI);
10928
10929 /// Check declaration inside target region.
10930 void
10932 SourceLocation IdLoc = SourceLocation());
10933 /// Finishes analysis of the deferred functions calls that may be declared as
10934 /// host/nohost during device/host compilation.
10936 const FunctionDecl *Callee,
10937 SourceLocation Loc);
10938
10939 /// Return true if currently in OpenMP task with untied clause context.
10940 bool isInOpenMPTaskUntiedContext() const;
10941
10942 /// Return true inside OpenMP declare target region.
10944 return !DeclareTargetNesting.empty();
10945 }
10946 /// Return true inside OpenMP target region.
10948
10949 /// Return the number of captured regions created for an OpenMP directive.
10951
10952 /// Initialization of captured region for OpenMP region.
10953 void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope);
10954
10955 /// Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to
10956 /// an OpenMP loop directive.
10958
10959 /// Process a canonical OpenMP loop nest that can either be a canonical
10960 /// literal loop (ForStmt or CXXForRangeStmt), or the generated loop of an
10961 /// OpenMP loop transformation construct.
10963
10964 /// End of OpenMP region.
10965 ///
10966 /// \param S Statement associated with the current OpenMP region.
10967 /// \param Clauses List of clauses for the current OpenMP region.
10968 ///
10969 /// \returns Statement for finished OpenMP region.
10972 OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
10973 OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
10974 Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc);
10975 /// Called on well-formed '\#pragma omp parallel' after parsing
10976 /// of the associated statement.
10978 Stmt *AStmt,
10979 SourceLocation StartLoc,
10980 SourceLocation EndLoc);
10982 llvm::SmallDenseMap<const ValueDecl *, const Expr *, 4>;
10983 /// Called on well-formed '\#pragma omp simd' after parsing
10984 /// of the associated statement.
10987 SourceLocation StartLoc, SourceLocation EndLoc,
10988 VarsWithInheritedDSAType &VarsWithImplicitDSA);
10989 /// Called on well-formed '#pragma omp tile' after parsing of its clauses and
10990 /// the associated statement.
10992 Stmt *AStmt, SourceLocation StartLoc,
10993 SourceLocation EndLoc);
10994 /// Called on well-formed '#pragma omp unroll' after parsing of its clauses
10995 /// and the associated statement.
10997 Stmt *AStmt, SourceLocation StartLoc,
10998 SourceLocation EndLoc);
10999 /// Called on well-formed '\#pragma omp for' after parsing
11000 /// of the associated statement.
11003 SourceLocation StartLoc, SourceLocation EndLoc,
11004 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11005 /// Called on well-formed '\#pragma omp for simd' after parsing
11006 /// of the associated statement.
11009 SourceLocation StartLoc, SourceLocation EndLoc,
11010 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11011 /// Called on well-formed '\#pragma omp sections' after parsing
11012 /// of the associated statement.
11014 Stmt *AStmt, SourceLocation StartLoc,
11015 SourceLocation EndLoc);
11016 /// Called on well-formed '\#pragma omp section' after parsing of the
11017 /// associated statement.
11019 SourceLocation EndLoc);
11020 /// Called on well-formed '\#pragma omp single' after parsing of the
11021 /// associated statement.
11023 Stmt *AStmt, SourceLocation StartLoc,
11024 SourceLocation EndLoc);
11025 /// Called on well-formed '\#pragma omp master' after parsing of the
11026 /// associated statement.
11028 SourceLocation EndLoc);
11029 /// Called on well-formed '\#pragma omp critical' after parsing of the
11030 /// associated statement.
11032 ArrayRef<OMPClause *> Clauses,
11033 Stmt *AStmt, SourceLocation StartLoc,
11034 SourceLocation EndLoc);
11035 /// Called on well-formed '\#pragma omp parallel for' after parsing
11036 /// of the associated statement.
11038 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11039 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11040 /// Called on well-formed '\#pragma omp parallel for simd' after
11041 /// parsing of the associated statement.
11043 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11044 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11045 /// Called on well-formed '\#pragma omp parallel master' after
11046 /// parsing of the associated statement.
11048 Stmt *AStmt,
11049 SourceLocation StartLoc,
11050 SourceLocation EndLoc);
11051 /// Called on well-formed '\#pragma omp parallel masked' after
11052 /// parsing of the associated statement.
11054 Stmt *AStmt,
11055 SourceLocation StartLoc,
11056 SourceLocation EndLoc);
11057 /// Called on well-formed '\#pragma omp parallel sections' after
11058 /// parsing of the associated statement.
11060 Stmt *AStmt,
11061 SourceLocation StartLoc,
11062 SourceLocation EndLoc);
11063 /// Called on well-formed '\#pragma omp task' after parsing of the
11064 /// associated statement.
11066 Stmt *AStmt, SourceLocation StartLoc,
11067 SourceLocation EndLoc);
11068 /// Called on well-formed '\#pragma omp taskyield'.
11070 SourceLocation EndLoc);
11071 /// Called on well-formed '\#pragma omp barrier'.
11073 SourceLocation EndLoc);
11074 /// Called on well-formed '\#pragma omp taskwait'.
11076 SourceLocation StartLoc,
11077 SourceLocation EndLoc);
11078 /// Called on well-formed '\#pragma omp taskgroup'.
11080 Stmt *AStmt, SourceLocation StartLoc,
11081 SourceLocation EndLoc);
11082 /// Called on well-formed '\#pragma omp flush'.
11084 SourceLocation StartLoc,
11085 SourceLocation EndLoc);
11086 /// Called on well-formed '\#pragma omp depobj'.
11088 SourceLocation StartLoc,
11089 SourceLocation EndLoc);
11090 /// Called on well-formed '\#pragma omp scan'.
11092 SourceLocation StartLoc,
11093 SourceLocation EndLoc);
11094 /// Called on well-formed '\#pragma omp ordered' after parsing of the
11095 /// associated statement.
11097 Stmt *AStmt, SourceLocation StartLoc,
11098 SourceLocation EndLoc);
11099 /// Called on well-formed '\#pragma omp atomic' after parsing of the
11100 /// associated statement.
11102 Stmt *AStmt, SourceLocation StartLoc,
11103 SourceLocation EndLoc);
11104 /// Called on well-formed '\#pragma omp target' after parsing of the
11105 /// associated statement.
11107 Stmt *AStmt, SourceLocation StartLoc,
11108 SourceLocation EndLoc);
11109 /// Called on well-formed '\#pragma omp target data' after parsing of
11110 /// the associated statement.
11112 Stmt *AStmt, SourceLocation StartLoc,
11113 SourceLocation EndLoc);
11114 /// Called on well-formed '\#pragma omp target enter data' after
11115 /// parsing of the associated statement.
11117 SourceLocation StartLoc,
11118 SourceLocation EndLoc,
11119 Stmt *AStmt);
11120 /// Called on well-formed '\#pragma omp target exit data' after
11121 /// parsing of the associated statement.
11123 SourceLocation StartLoc,
11124 SourceLocation EndLoc,
11125 Stmt *AStmt);
11126 /// Called on well-formed '\#pragma omp target parallel' after
11127 /// parsing of the associated statement.
11129 Stmt *AStmt,
11130 SourceLocation StartLoc,
11131 SourceLocation EndLoc);
11132 /// Called on well-formed '\#pragma omp target parallel for' after
11133 /// parsing of the associated statement.
11135 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11136 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11137 /// Called on well-formed '\#pragma omp teams' after parsing of the
11138 /// associated statement.
11140 Stmt *AStmt, SourceLocation StartLoc,
11141 SourceLocation EndLoc);
11142 /// Called on well-formed '\#pragma omp teams loop' after parsing of the
11143 /// associated statement.
11145 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11146 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11147 /// Called on well-formed '\#pragma omp target teams loop' after parsing of
11148 /// the associated statement.
11150 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11151 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11152 /// Called on well-formed '\#pragma omp parallel loop' after parsing of the
11153 /// associated statement.
11155 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11156 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11157 /// Called on well-formed '\#pragma omp target parallel loop' after parsing
11158 /// of the associated statement.
11160 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11161 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11162 /// Called on well-formed '\#pragma omp cancellation point'.
11165 SourceLocation EndLoc,
11166 OpenMPDirectiveKind CancelRegion);
11167 /// Called on well-formed '\#pragma omp cancel'.
11169 SourceLocation StartLoc,
11170 SourceLocation EndLoc,
11171 OpenMPDirectiveKind CancelRegion);
11172 /// Called on well-formed '\#pragma omp taskloop' after parsing of the
11173 /// associated statement.
11176 SourceLocation StartLoc, SourceLocation EndLoc,
11177 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11178 /// Called on well-formed '\#pragma omp taskloop simd' after parsing of
11179 /// the associated statement.
11181 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11182 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11183 /// Called on well-formed '\#pragma omp master taskloop' after parsing of the
11184 /// associated statement.
11186 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11187 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11188 /// Called on well-formed '\#pragma omp master taskloop simd' after parsing of
11189 /// the associated statement.
11191 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11192 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11193 /// Called on well-formed '\#pragma omp parallel master taskloop' after
11194 /// parsing of the associated statement.
11196 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11197 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11198 /// Called on well-formed '\#pragma omp parallel master taskloop simd' after
11199 /// parsing of the associated statement.
11201 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11202 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11203 /// Called on well-formed '\#pragma omp masked taskloop' after parsing of the
11204 /// associated statement.
11206 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11207 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11208 /// Called on well-formed '\#pragma omp masked taskloop simd' after parsing of
11209 /// the associated statement.
11211 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11212 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11213 /// Called on well-formed '\#pragma omp parallel masked taskloop' after
11214 /// parsing of the associated statement.
11216 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11217 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11218 /// Called on well-formed '\#pragma omp parallel masked taskloop simd' after
11219 /// parsing of the associated statement.
11221 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11222 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11223 /// Called on well-formed '\#pragma omp distribute' after parsing
11224 /// of the associated statement.
11227 SourceLocation StartLoc, SourceLocation EndLoc,
11228 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11229 /// Called on well-formed '\#pragma omp target update'.
11231 SourceLocation StartLoc,
11232 SourceLocation EndLoc,
11233 Stmt *AStmt);
11234 /// Called on well-formed '\#pragma omp distribute parallel for' after
11235 /// parsing of the associated statement.
11237 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11238 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11239 /// Called on well-formed '\#pragma omp distribute parallel for simd'
11240 /// after parsing of the associated statement.
11242 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11243 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11244 /// Called on well-formed '\#pragma omp distribute simd' after
11245 /// parsing of the associated statement.
11247 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11248 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11249 /// Called on well-formed '\#pragma omp target parallel for simd' after
11250 /// parsing of the associated statement.
11252 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11253 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11254 /// Called on well-formed '\#pragma omp target simd' after parsing of
11255 /// the associated statement.
11258 SourceLocation StartLoc, SourceLocation EndLoc,
11259 VarsWithInheritedDSAType &VarsWithImplicitDSA);
11260 /// Called on well-formed '\#pragma omp teams distribute' after parsing of
11261 /// the associated statement.
11263 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11264 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11265 /// Called on well-formed '\#pragma omp teams distribute simd' after parsing
11266 /// of the associated statement.
11268 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11269 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11270 /// Called on well-formed '\#pragma omp teams distribute parallel for simd'
11271 /// after parsing of the associated statement.
11273 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11274 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11275 /// Called on well-formed '\#pragma omp teams distribute parallel for'
11276 /// after parsing of the associated statement.
11278 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11279 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11280 /// Called on well-formed '\#pragma omp target teams' after parsing of the
11281 /// associated statement.
11283 Stmt *AStmt,
11284 SourceLocation StartLoc,
11285 SourceLocation EndLoc);
11286 /// Called on well-formed '\#pragma omp target teams distribute' after parsing
11287 /// of the associated statement.
11289 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11290 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11291 /// Called on well-formed '\#pragma omp target teams distribute parallel for'
11292 /// after parsing of the associated statement.
11294 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11295 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11296 /// Called on well-formed '\#pragma omp target teams distribute parallel for
11297 /// simd' after parsing of the associated statement.
11299 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11300 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11301 /// Called on well-formed '\#pragma omp target teams distribute simd' after
11302 /// parsing of the associated statement.
11304 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11305 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11306 /// Called on well-formed '\#pragma omp interop'.
11308 SourceLocation StartLoc,
11309 SourceLocation EndLoc);
11310 /// Called on well-formed '\#pragma omp dispatch' after parsing of the
11311 // /associated statement.
11313 Stmt *AStmt, SourceLocation StartLoc,
11314 SourceLocation EndLoc);
11315 /// Called on well-formed '\#pragma omp masked' after parsing of the
11316 // /associated statement.
11318 Stmt *AStmt, SourceLocation StartLoc,
11319 SourceLocation EndLoc);
11320
11321 /// Called on well-formed '\#pragma omp loop' after parsing of the
11322 /// associated statement.
11324 ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
11325 SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA);
11326
11327 /// Checks correctness of linear modifiers.
11329 SourceLocation LinLoc);
11330 /// Checks that the specified declaration matches requirements for the linear
11331 /// decls.
11334 bool IsDeclareSimd = false);
11335
11336 /// Called on well-formed '\#pragma omp declare simd' after parsing of
11337 /// the associated method/function.
11339 DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS,
11340 Expr *Simdlen, ArrayRef<Expr *> Uniforms, ArrayRef<Expr *> Aligneds,
11341 ArrayRef<Expr *> Alignments, ArrayRef<Expr *> Linears,
11342 ArrayRef<unsigned> LinModifiers, ArrayRef<Expr *> Steps, SourceRange SR);
11343
11344 /// Checks '\#pragma omp declare variant' variant function and original
11345 /// functions after parsing of the associated method/function.
11346 /// \param DG Function declaration to which declare variant directive is
11347 /// applied to.
11348 /// \param VariantRef Expression that references the variant function, which
11349 /// must be used instead of the original one, specified in \p DG.
11350 /// \param TI The trait info object representing the match clause.
11351 /// \param NumAppendArgs The number of omp_interop_t arguments to account for
11352 /// in checking.
11353 /// \returns None, if the function/variant function are not compatible with
11354 /// the pragma, pair of original function/variant ref expression otherwise.
11357 OMPTraitInfo &TI, unsigned NumAppendArgs,
11358 SourceRange SR);
11359
11360 /// Called on well-formed '\#pragma omp declare variant' after parsing of
11361 /// the associated method/function.
11362 /// \param FD Function declaration to which declare variant directive is
11363 /// applied to.
11364 /// \param VariantRef Expression that references the variant function, which
11365 /// must be used instead of the original one, specified in \p DG.
11366 /// \param TI The context traits associated with the function variant.
11367 /// \param AdjustArgsNothing The list of 'nothing' arguments.
11368 /// \param AdjustArgsNeedDevicePtr The list of 'need_device_ptr' arguments.
11369 /// \param AppendArgs The list of 'append_args' arguments.
11370 /// \param AdjustArgsLoc The Location of an 'adjust_args' clause.
11371 /// \param AppendArgsLoc The Location of an 'append_args' clause.
11372 /// \param SR The SourceRange of the 'declare variant' directive.
11374 FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI,
11375 ArrayRef<Expr *> AdjustArgsNothing,
11376 ArrayRef<Expr *> AdjustArgsNeedDevicePtr,
11378 SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc,
11379 SourceRange SR);
11380
11382 Expr *Expr,
11383 SourceLocation StartLoc,
11384 SourceLocation LParenLoc,
11385 SourceLocation EndLoc);
11386 /// Called on well-formed 'allocator' clause.
11388 SourceLocation StartLoc,
11389 SourceLocation LParenLoc,
11390 SourceLocation EndLoc);
11391 /// Called on well-formed 'if' clause.
11393 Expr *Condition, SourceLocation StartLoc,
11394 SourceLocation LParenLoc,
11395 SourceLocation NameModifierLoc,
11396 SourceLocation ColonLoc,
11397 SourceLocation EndLoc);
11398 /// Called on well-formed 'final' clause.
11400 SourceLocation LParenLoc,
11401 SourceLocation EndLoc);
11402 /// Called on well-formed 'num_threads' clause.
11404 SourceLocation StartLoc,
11405 SourceLocation LParenLoc,
11406 SourceLocation EndLoc);
11407 /// Called on well-formed 'align' clause.
11409 SourceLocation LParenLoc,
11410 SourceLocation EndLoc);
11411 /// Called on well-formed 'safelen' clause.
11413 SourceLocation StartLoc,
11414 SourceLocation LParenLoc,
11415 SourceLocation EndLoc);
11416 /// Called on well-formed 'simdlen' clause.
11418 SourceLocation LParenLoc,
11419 SourceLocation EndLoc);
11420 /// Called on well-form 'sizes' clause.
11422 SourceLocation StartLoc,
11423 SourceLocation LParenLoc,
11424 SourceLocation EndLoc);
11425 /// Called on well-form 'full' clauses.
11427 SourceLocation EndLoc);
11428 /// Called on well-form 'partial' clauses.
11430 SourceLocation LParenLoc,
11431 SourceLocation EndLoc);
11432 /// Called on well-formed 'collapse' clause.
11434 SourceLocation StartLoc,
11435 SourceLocation LParenLoc,
11436 SourceLocation EndLoc);
11437 /// Called on well-formed 'ordered' clause.
11438 OMPClause *
11440 SourceLocation LParenLoc = SourceLocation(),
11441 Expr *NumForLoops = nullptr);
11442 /// Called on well-formed 'grainsize' clause.
11444 SourceLocation LParenLoc,
11445 SourceLocation EndLoc);
11446 /// Called on well-formed 'num_tasks' clause.
11448 SourceLocation LParenLoc,
11449 SourceLocation EndLoc);
11450 /// Called on well-formed 'hint' clause.
11452 SourceLocation LParenLoc,
11453 SourceLocation EndLoc);
11454 /// Called on well-formed 'detach' clause.
11456 SourceLocation LParenLoc,
11457 SourceLocation EndLoc);
11458
11460 unsigned Argument,
11461 SourceLocation ArgumentLoc,
11462 SourceLocation StartLoc,
11463 SourceLocation LParenLoc,
11464 SourceLocation EndLoc);
11465 /// Called on well-formed 'when' clause.
11467 SourceLocation LParenLoc,
11468 SourceLocation EndLoc);
11469 /// Called on well-formed 'default' clause.
11470 OMPClause *ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind,
11471 SourceLocation KindLoc,
11472 SourceLocation StartLoc,
11473 SourceLocation LParenLoc,
11474 SourceLocation EndLoc);
11475 /// Called on well-formed 'proc_bind' clause.
11476 OMPClause *ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind,
11477 SourceLocation KindLoc,
11478 SourceLocation StartLoc,
11479 SourceLocation LParenLoc,
11480 SourceLocation EndLoc);
11481 /// Called on well-formed 'order' clause.
11483 SourceLocation KindLoc,
11484 SourceLocation StartLoc,
11485 SourceLocation LParenLoc,
11486 SourceLocation EndLoc);
11487 /// Called on well-formed 'update' clause.
11489 SourceLocation KindLoc,
11490 SourceLocation StartLoc,
11491 SourceLocation LParenLoc,
11492 SourceLocation EndLoc);
11493
11495 OpenMPClauseKind Kind, ArrayRef<unsigned> Arguments, Expr *Expr,
11496 SourceLocation StartLoc, SourceLocation LParenLoc,
11497 ArrayRef<SourceLocation> ArgumentsLoc, SourceLocation DelimLoc,
11498 SourceLocation EndLoc);
11499 /// Called on well-formed 'schedule' clause.
11502 OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc,
11503 SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc,
11504 SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc);
11505
11507 SourceLocation EndLoc);
11508 /// Called on well-formed 'nowait' clause.
11510 SourceLocation EndLoc);
11511 /// Called on well-formed 'untied' clause.
11513 SourceLocation EndLoc);
11514 /// Called on well-formed 'mergeable' clause.
11516 SourceLocation EndLoc);
11517 /// Called on well-formed 'read' clause.
11519 SourceLocation EndLoc);
11520 /// Called on well-formed 'write' clause.
11522 SourceLocation EndLoc);
11523 /// Called on well-formed 'update' clause.
11525 SourceLocation EndLoc);
11526 /// Called on well-formed 'capture' clause.
11528 SourceLocation EndLoc);
11529 /// Called on well-formed 'compare' clause.
11531 SourceLocation EndLoc);
11532 /// Called on well-formed 'seq_cst' clause.
11534 SourceLocation EndLoc);
11535 /// Called on well-formed 'acq_rel' clause.
11537 SourceLocation EndLoc);
11538 /// Called on well-formed 'acquire' clause.
11540 SourceLocation EndLoc);
11541 /// Called on well-formed 'release' clause.
11543 SourceLocation EndLoc);
11544 /// Called on well-formed 'relaxed' clause.
11546 SourceLocation EndLoc);
11547
11548 /// Called on well-formed 'init' clause.
11549 OMPClause *ActOnOpenMPInitClause(Expr *InteropVar, ArrayRef<Expr *> PrefExprs,
11550 bool IsTarget, bool IsTargetSync,
11551 SourceLocation StartLoc,
11552 SourceLocation LParenLoc,
11553 SourceLocation VarLoc,
11554 SourceLocation EndLoc);
11555
11556 /// Called on well-formed 'use' clause.
11557 OMPClause *ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc,
11558 SourceLocation LParenLoc,
11559 SourceLocation VarLoc, SourceLocation EndLoc);
11560
11561 /// Called on well-formed 'destroy' clause.
11563 SourceLocation LParenLoc,
11564 SourceLocation VarLoc,
11565 SourceLocation EndLoc);
11566 /// Called on well-formed 'novariants' clause.
11568 SourceLocation StartLoc,
11569 SourceLocation LParenLoc,
11570 SourceLocation EndLoc);
11571 /// Called on well-formed 'nocontext' clause.
11573 SourceLocation StartLoc,
11574 SourceLocation LParenLoc,
11575 SourceLocation EndLoc);
11576 /// Called on well-formed 'filter' clause.
11578 SourceLocation LParenLoc,
11579 SourceLocation EndLoc);
11580 /// Called on well-formed 'threads' clause.
11582 SourceLocation EndLoc);
11583 /// Called on well-formed 'simd' clause.
11585 SourceLocation EndLoc);
11586 /// Called on well-formed 'nogroup' clause.
11588 SourceLocation EndLoc);
11589 /// Called on well-formed 'unified_address' clause.
11591 SourceLocation EndLoc);
11592
11593 /// Called on well-formed 'unified_address' clause.
11595 SourceLocation EndLoc);
11596
11597 /// Called on well-formed 'reverse_offload' clause.
11599 SourceLocation EndLoc);
11600
11601 /// Called on well-formed 'dynamic_allocators' clause.
11603 SourceLocation EndLoc);
11604
11605 /// Called on well-formed 'atomic_default_mem_order' clause.
11608 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
11609
11610 /// Data used for processing a list of variables in OpenMP clauses.
11630
11632 ArrayRef<Expr *> Vars,
11633 const OMPVarListLocTy &Locs,
11634 OpenMPVarListDataTy &Data);
11635 /// Called on well-formed 'inclusive' clause.
11637 SourceLocation StartLoc,
11638 SourceLocation LParenLoc,
11639 SourceLocation EndLoc);
11640 /// Called on well-formed 'exclusive' clause.
11642 SourceLocation StartLoc,
11643 SourceLocation LParenLoc,
11644 SourceLocation EndLoc);
11645 /// Called on well-formed 'allocate' clause.
11646 OMPClause *
11648 SourceLocation StartLoc, SourceLocation ColonLoc,
11649 SourceLocation LParenLoc, SourceLocation EndLoc);
11650 /// Called on well-formed 'private' clause.
11652 SourceLocation StartLoc,
11653 SourceLocation LParenLoc,
11654 SourceLocation EndLoc);
11655 /// Called on well-formed 'firstprivate' clause.
11657 SourceLocation StartLoc,
11658 SourceLocation LParenLoc,
11659 SourceLocation EndLoc);
11660 /// Called on well-formed 'lastprivate' clause.
11663 SourceLocation LPKindLoc, SourceLocation ColonLoc,
11664 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc);
11665 /// Called on well-formed 'shared' clause.
11667 SourceLocation StartLoc,
11668 SourceLocation LParenLoc,
11669 SourceLocation EndLoc);
11670 /// Called on well-formed 'reduction' clause.
11673 SourceLocation StartLoc, SourceLocation LParenLoc,
11674 SourceLocation ModifierLoc, SourceLocation ColonLoc,
11675 SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec,
11676 const DeclarationNameInfo &ReductionId,
11677 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11678 /// Called on well-formed 'task_reduction' clause.
11680 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
11681 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
11682 CXXScopeSpec &ReductionIdScopeSpec,
11683 const DeclarationNameInfo &ReductionId,
11684 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11685 /// Called on well-formed 'in_reduction' clause.
11687 ArrayRef<Expr *> VarList, SourceLocation StartLoc,
11688 SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc,
11689 CXXScopeSpec &ReductionIdScopeSpec,
11690 const DeclarationNameInfo &ReductionId,
11691 ArrayRef<Expr *> UnresolvedReductions = llvm::None);
11692 /// Called on well-formed 'linear' clause.
11693 OMPClause *
11695 SourceLocation StartLoc, SourceLocation LParenLoc,
11696 OpenMPLinearClauseKind LinKind, SourceLocation LinLoc,
11697 SourceLocation ColonLoc, SourceLocation EndLoc);
11698 /// Called on well-formed 'aligned' clause.
11700 Expr *Alignment,
11701 SourceLocation StartLoc,
11702 SourceLocation LParenLoc,
11703 SourceLocation ColonLoc,
11704 SourceLocation EndLoc);
11705 /// Called on well-formed 'copyin' clause.
11707 SourceLocation StartLoc,
11708 SourceLocation LParenLoc,
11709 SourceLocation EndLoc);
11710 /// Called on well-formed 'copyprivate' clause.
11712 SourceLocation StartLoc,
11713 SourceLocation LParenLoc,
11714 SourceLocation EndLoc);
11715 /// Called on well-formed 'flush' pseudo clause.
11717 SourceLocation StartLoc,
11718 SourceLocation LParenLoc,
11719 SourceLocation EndLoc);
11720 /// Called on well-formed 'depobj' pseudo clause.
11722 SourceLocation LParenLoc,
11723 SourceLocation EndLoc);
11724 /// Called on well-formed 'depend' clause.
11726 Expr *DepModifier,
11727 ArrayRef<Expr *> VarList,
11728 SourceLocation StartLoc,
11729 SourceLocation LParenLoc,
11730 SourceLocation EndLoc);
11731 /// Called on well-formed 'device' clause.
11733 Expr *Device, SourceLocation StartLoc,
11734 SourceLocation LParenLoc,
11735 SourceLocation ModifierLoc,
11736 SourceLocation EndLoc);
11737 /// Called on well-formed 'map' clause.
11739 ArrayRef<OpenMPMapModifierKind> MapTypeModifiers,
11740 ArrayRef<SourceLocation> MapTypeModifiersLoc,
11741 CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId,
11742 OpenMPMapClauseKind MapType, bool IsMapTypeImplicit,
11743 SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef<Expr *> VarList,
11744 const OMPVarListLocTy &Locs, bool NoDiagnose = false,
11745 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11746 /// Called on well-formed 'num_teams' clause.
11748 SourceLocation LParenLoc,
11749 SourceLocation EndLoc);
11750 /// Called on well-formed 'thread_limit' clause.
11752 SourceLocation StartLoc,
11753 SourceLocation LParenLoc,
11754 SourceLocation EndLoc);
11755 /// Called on well-formed 'priority' clause.
11757 SourceLocation LParenLoc,
11758 SourceLocation EndLoc);
11759 /// Called on well-formed 'dist_schedule' clause.
11761 OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize,
11762 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc,
11763 SourceLocation CommaLoc, SourceLocation EndLoc);
11764 /// Called on well-formed 'defaultmap' clause.
11767 SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc,
11768 SourceLocation KindLoc, SourceLocation EndLoc);
11769 /// Called on well-formed 'to' clause.
11770 OMPClause *
11772 ArrayRef<SourceLocation> MotionModifiersLoc,
11773 CXXScopeSpec &MapperIdScopeSpec,
11774 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
11775 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
11776 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11777 /// Called on well-formed 'from' clause.
11778 OMPClause *
11780 ArrayRef<SourceLocation> MotionModifiersLoc,
11781 CXXScopeSpec &MapperIdScopeSpec,
11782 DeclarationNameInfo &MapperId, SourceLocation ColonLoc,
11783 ArrayRef<Expr *> VarList, const OMPVarListLocTy &Locs,
11784 ArrayRef<Expr *> UnresolvedMappers = llvm::None);
11785 /// Called on well-formed 'use_device_ptr' clause.
11787 const OMPVarListLocTy &Locs);
11788 /// Called on well-formed 'use_device_addr' clause.
11790 const OMPVarListLocTy &Locs);
11791 /// Called on well-formed 'is_device_ptr' clause.
11793 const OMPVarListLocTy &Locs);
11794 /// Called on well-formed 'has_device_addr' clause.
11796 const OMPVarListLocTy &Locs);
11797 /// Called on well-formed 'nontemporal' clause.
11799 SourceLocation StartLoc,
11800 SourceLocation LParenLoc,
11801 SourceLocation EndLoc);
11802
11803 /// Data for list of allocators.
11805 /// Allocator.
11806 Expr *Allocator = nullptr;
11807 /// Allocator traits.
11809 /// Locations of '(' and ')' symbols.
11811 };
11812 /// Called on well-formed 'uses_allocators' clause.
11814 SourceLocation LParenLoc,
11815 SourceLocation EndLoc,
11817 /// Called on well-formed 'affinity' clause.
11819 SourceLocation LParenLoc,
11820 SourceLocation ColonLoc,
11821 SourceLocation EndLoc, Expr *Modifier,
11822 ArrayRef<Expr *> Locators);
11823 /// Called on a well-formed 'bind' clause.
11825 SourceLocation KindLoc,
11826 SourceLocation StartLoc,
11827 SourceLocation LParenLoc,
11828 SourceLocation EndLoc);
11829
11830 /// The kind of conversion being performed.
11832 /// An implicit conversion.
11834 /// A C-style cast.
11836 /// A functional-style cast.
11838 /// A cast other than a C-style cast.
11840 /// A conversion for an operand of a builtin overloaded operator.
11843
11845 return CCK == CCK_CStyleCast || CCK == CCK_FunctionalCast ||
11846 CCK == CCK_OtherCast;
11847 }
11848
11849 /// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit
11850 /// cast. If there is already an implicit cast, merge into the existing one.
11851 /// If isLvalue, the result of the cast is an lvalue.
11855 const CXXCastPath *BasePath = nullptr,
11857
11858 /// ScalarTypeToBooleanCastKind - Returns the cast kind corresponding
11859 /// to the conversion from scalar type ScalarTy to the Boolean type.
11861
11862 /// IgnoredValueConversions - Given that an expression's result is
11863 /// syntactically ignored, perform any conversions that are
11864 /// required.
11866
11867 // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts
11868 // functions and arrays to their respective pointers (C99 6.3.2.1).
11870
11871 /// CallExprUnaryConversions - a special case of an unary conversion
11872 /// performed on a function designator of a call expression.
11874
11875 // DefaultFunctionArrayConversion - converts functions and arrays
11876 // to their respective pointers (C99 6.3.2.1).
11878
11879 // DefaultFunctionArrayLvalueConversion - converts functions and
11880 // arrays to their respective pointers and performs the
11881 // lvalue-to-rvalue conversion.
11883 bool Diagnose = true);
11884
11885 // DefaultLvalueConversion - performs lvalue-to-rvalue conversion on
11886 // the operand. This function is a no-op if the operand has a function type
11887 // or an array type.
11889
11890 // DefaultArgumentPromotion (C99 6.5.2.2p6). Used for function calls that
11891 // do not have a prototype. Integer promotions are performed on each
11892 // argument, and arguments that have type float are promoted to double.
11894
11895 /// If \p E is a prvalue denoting an unmaterialized temporary, materialize
11896 /// it as an xvalue. In C++98, the result will still be a prvalue, because
11897 /// we don't have xvalues there.
11899
11900 // Used for emitting the right warning by DefaultVariadicArgumentPromotion
11908
11910 const FunctionProtoType *Proto,
11911 Expr *Fn);
11912
11913 // Used for determining in which context a type is allowed to be passed to a
11914 // vararg function.
11922
11923 // Determines which VarArgKind fits an expression.
11925
11926 /// Check to see if the given expression is a valid argument to a variadic
11927 /// function, issuing a diagnostic if not.
11928 void checkVariadicArgument(const Expr *E, VariadicCallType CT);
11929
11930 /// Check whether the given statement can have musttail applied to it,
11931 /// issuing a diagnostic and returning false if not. In the success case,
11932 /// the statement is rewritten to remove implicit nodes from the return
11933 /// value.
11934 bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA);
11935
11936private:
11937 /// Check whether the given statement can have musttail applied to it,
11938 /// issuing a diagnostic and returning false if not.
11939 bool checkMustTailAttr(const Stmt *St, const Attr &MTA);
11940
11941public:
11942 /// Check to see if a given expression could have '.c_str()' called on it.
11943 bool hasCStrMethod(const Expr *E);
11944
11945 /// GatherArgumentsForCall - Collector argument expressions for various
11946 /// form of call prototypes.
11948 const FunctionProtoType *Proto,
11949 unsigned FirstParam, ArrayRef<Expr *> Args,
11950 SmallVectorImpl<Expr *> &AllArgs,
11952 bool AllowExplicit = false,
11953 bool IsListInitialization = false);
11954
11955 // DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but
11956 // will create a runtime trap if the resulting type is not a POD type.
11958 FunctionDecl *FDecl);
11959
11960 /// Context in which we're performing a usual arithmetic conversion.
11962 /// An arithmetic operation.
11964 /// A bitwise operation.
11966 /// A comparison.
11968 /// A conditional (?:) operator.
11970 /// A compound assignment expression.
11972 };
11973
11974 // UsualArithmeticConversions - performs the UsualUnaryConversions on it's
11975 // operands and then handles various conversions that are common to binary
11976 // operators (C99 6.3.1.8). If both operands aren't arithmetic, this
11977 // routine returns the first non-arithmetic type found. The client is
11978 // responsible for emitting appropriate error diagnostics.
11980 SourceLocation Loc, ArithConvKind ACK);
11981
11982 /// AssignConvertType - All of the 'assignment' semantic checks return this
11983 /// enum to indicate whether the assignment was allowed. These checks are
11984 /// done for simple assignments, as well as initialization, return from
11985 /// function, argument passing, etc. The query is phrased in terms of a
11986 /// source and destination type.
11988 /// Compatible - the types are compatible according to the standard.
11990
11991 /// PointerToInt - The assignment converts a pointer to an int, which we
11992 /// accept as an extension.
11994
11995 /// IntToPointer - The assignment converts an int to a pointer, which we
11996 /// accept as an extension.
11998
11999 /// FunctionVoidPointer - The assignment is between a function pointer and
12000 /// void*, which the standard doesn't allow, but we accept as an extension.
12002
12003 /// IncompatiblePointer - The assignment is between two pointers types that
12004 /// are not compatible, but we accept them as an extension.
12006
12007 /// IncompatibleFunctionPointer - The assignment is between two function
12008 /// pointers types that are not compatible, but we accept them as an
12009 /// extension.
12011
12012 /// IncompatiblePointerSign - The assignment is between two pointers types
12013 /// which point to integers which have a different sign, but are otherwise
12014 /// identical. This is a subset of the above, but broken out because it's by
12015 /// far the most common case of incompatible pointers.
12017
12018 /// CompatiblePointerDiscardsQualifiers - The assignment discards
12019 /// c/v/r qualifiers, which we accept as an extension.
12021
12022 /// IncompatiblePointerDiscardsQualifiers - The assignment
12023 /// discards qualifiers that we don't permit to be discarded,
12024 /// like address spaces.
12026
12027 /// IncompatibleNestedPointerAddressSpaceMismatch - The assignment
12028 /// changes address spaces in nested pointer types which is not allowed.
12029 /// For instance, converting __private int ** to __generic int ** is
12030 /// illegal even though __private could be converted to __generic.
12032
12033 /// IncompatibleNestedPointerQualifiers - The assignment is between two
12034 /// nested pointer types, and the qualifiers other than the first two
12035 /// levels differ e.g. char ** -> const char **, but we accept them as an
12036 /// extension.
12038
12039 /// IncompatibleVectors - The assignment is between two vector types that
12040 /// have the same size, which we accept as an extension.
12042
12043 /// IntToBlockPointer - The assignment converts an int to a block
12044 /// pointer. We disallow this.
12046
12047 /// IncompatibleBlockPointer - The assignment is between two block
12048 /// pointers types that are not compatible.
12050
12051 /// IncompatibleObjCQualifiedId - The assignment is between a qualified
12052 /// id type and something else (that is incompatible with it). For example,
12053 /// "id <XXX>" = "Foo *", where "Foo *" doesn't implement the XXX protocol.
12055
12056 /// IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an
12057 /// object with __weak qualifier.
12059
12060 /// Incompatible - We reject this conversion outright, it is invalid to
12061 /// represent it in the AST.
12064
12065 /// DiagnoseAssignmentResult - Emit a diagnostic, if required, for the
12066 /// assignment conversion type specified by ConvTy. This returns true if the
12067 /// conversion was invalid or false if the conversion was accepted.
12069 SourceLocation Loc,
12070 QualType DstType, QualType SrcType,
12071 Expr *SrcExpr, AssignmentAction Action,
12072 bool *Complained = nullptr);
12073
12074 /// IsValueInFlagEnum - Determine if a value is allowed as part of a flag
12075 /// enum. If AllowMask is true, then we also allow the complement of a valid
12076 /// value, to be used as a mask.
12077 bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
12078 bool AllowMask) const;
12079
12080 /// DiagnoseAssignmentEnum - Warn if assignment to enum is a constant
12081 /// integer not in the range of enum values.
12082 void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType,
12083 Expr *SrcExpr);
12084
12085 /// CheckAssignmentConstraints - Perform type checking for assignment,
12086 /// argument passing, variable initialization, and function return values.
12087 /// C99 6.5.16.
12089 QualType LHSType,
12090 QualType RHSType);
12091
12092 /// Check assignment constraints and optionally prepare for a conversion of
12093 /// the RHS to the LHS type. The conversion is prepared for if ConvertRHS
12094 /// is true.
12096 ExprResult &RHS,
12097 CastKind &Kind,
12098 bool ConvertRHS = true);
12099
12100 /// Check assignment constraints for an assignment of RHS to LHSType.
12101 ///
12102 /// \param LHSType The destination type for the assignment.
12103 /// \param RHS The source expression for the assignment.
12104 /// \param Diagnose If \c true, diagnostics may be produced when checking
12105 /// for assignability. If a diagnostic is produced, \p RHS will be
12106 /// set to ExprError(). Note that this function may still return
12107 /// without producing a diagnostic, even for an invalid assignment.
12108 /// \param DiagnoseCFAudited If \c true, the target is a function parameter
12109 /// in an audited Core Foundation API and does not need to be checked
12110 /// for ARC retain issues.
12111 /// \param ConvertRHS If \c true, \p RHS will be updated to model the
12112 /// conversions necessary to perform the assignment. If \c false,
12113 /// \p Diagnose must also be \c false.
12115 QualType LHSType, ExprResult &RHS, bool Diagnose = true,
12116 bool DiagnoseCFAudited = false, bool ConvertRHS = true);
12117
12118 // If the lhs type is a transparent union, check whether we
12119 // can initialize the transparent union with the given expression.
12121 ExprResult &RHS);
12122
12124
12125 bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType);
12126
12128 AssignmentAction Action,
12129 bool AllowExplicit = false);
12131 const ImplicitConversionSequence& ICS,
12132 AssignmentAction Action,
12136 const StandardConversionSequence& SCS,
12137 AssignmentAction Action,
12139
12143
12144 /// the following "Check" methods will return a valid/converted QualType
12145 /// or a null QualType (indicating an error diagnostic was issued).
12146
12147 /// type checking binary operators (subroutines of CreateBuiltinBinOp).
12149 ExprResult &RHS);
12151 ExprResult &RHS);
12153 ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK,
12154 SourceLocation OpLoc, bool isIndirect);
12156 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign,
12157 bool IsDivide);
12158 QualType CheckRemainderOperands( // C99 6.5.5
12159 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12160 bool IsCompAssign = false);
12161 QualType CheckAdditionOperands( // C99 6.5.6
12162 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12163 BinaryOperatorKind Opc, QualType* CompLHSTy = nullptr);
12165 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12166 QualType* CompLHSTy = nullptr);
12167 QualType CheckShiftOperands( // C99 6.5.7
12168 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12169 BinaryOperatorKind Opc, bool IsCompAssign = false);
12171 QualType CheckCompareOperands( // C99 6.5.8/9
12172 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12173 BinaryOperatorKind Opc);
12174 QualType CheckBitwiseOperands( // C99 6.5.[10...12]
12175 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12176 BinaryOperatorKind Opc);
12177 QualType CheckLogicalOperands( // C99 6.5.[13,14]
12178 ExprResult &LHS, ExprResult &RHS, SourceLocation Loc,
12179 BinaryOperatorKind Opc);
12180 // CheckAssignmentOperands is used for both simple and compound assignment.
12181 // For simple assignment, pass both expressions and a null converted type.
12182 // For compound assignment, pass both expressions and the converted type.
12183 QualType CheckAssignmentOperands( // C99 6.5.16.[1,2]
12184 Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType,
12185 BinaryOperatorKind Opc);
12186
12188 UnaryOperatorKind Opcode, Expr *Op);
12190 BinaryOperatorKind Opcode,
12191 Expr *LHS, Expr *RHS);
12194
12195 QualType CheckConditionalOperands( // C99 6.5.15
12196 ExprResult &Cond, ExprResult &LHS, ExprResult &RHS,
12197 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc);
12199 ExprResult &cond, ExprResult &lhs, ExprResult &rhs,
12200 ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc);
12202 ExprResult &RHS,
12203 SourceLocation QuestionLoc);
12204
12206 ExprResult &LHS, ExprResult &RHS,
12207 SourceLocation QuestionLoc);
12209 bool ConvertArgs = true);
12211 ExprResult &E1, ExprResult &E2,
12212 bool ConvertArgs = true) {
12213 Expr *E1Tmp = E1.get(), *E2Tmp = E2.get();
12214 QualType Composite =
12215 FindCompositePointerType(Loc, E1Tmp, E2Tmp, ConvertArgs);
12216 E1 = E1Tmp;
12217 E2 = E2Tmp;
12218 return Composite;
12219 }
12220
12222 SourceLocation QuestionLoc);
12223
12224 bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr,
12225 SourceLocation QuestionLoc);
12226
12229 bool IsEqual, SourceRange Range);
12230
12231 /// type checking for vector binary operators.
12233 SourceLocation Loc, bool IsCompAssign,
12234 bool AllowBothBool, bool AllowBoolConversion,
12235 bool AllowBoolOperation, bool ReportInvalid);
12239 SourceLocation Loc,
12240 BinaryOperatorKind Opc);
12242 SourceLocation Loc,
12243 BinaryOperatorKind Opc);
12245 SourceLocation Loc);
12246
12247 // type checking for sizeless vector binary operators.
12249 SourceLocation Loc, bool IsCompAssign,
12250 ArithConvKind OperationKind);
12251
12252 /// Type checking for matrix binary operators.
12254 SourceLocation Loc,
12255 bool IsCompAssign);
12257 SourceLocation Loc, bool IsCompAssign);
12258
12259 bool isValidSveBitcast(QualType srcType, QualType destType);
12260
12262
12263 bool areVectorTypesSameSize(QualType srcType, QualType destType);
12264 bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
12265 bool isLaxVectorConversion(QualType srcType, QualType destType);
12266 bool areSameVectorElemTypes(QualType srcType, QualType destType);
12267 bool anyAltivecTypes(QualType srcType, QualType destType);
12268
12269 /// type checking declaration initializers (C99 6.7.8)
12271
12272 // type checking C++ declaration initializers (C++ [dcl.init]).
12273
12274 /// ReferenceCompareResult - Expresses the result of comparing two
12275 /// types (cv1 T1 and cv2 T2) to determine their compatibility for the
12276 /// purposes of initialization by reference (C++ [dcl.init.ref]p4).
12278 /// Ref_Incompatible - The two types are incompatible, so direct
12279 /// reference binding is not possible.
12281 /// Ref_Related - The two types are reference-related, which means
12282 /// that their unqualified forms (T1 and T2) are either the same
12283 /// or T1 is a base class of T2.
12285 /// Ref_Compatible - The two types are reference-compatible.
12288
12289 // Fake up a scoped enumeration that still contextually converts to bool.
12291 /// The conversions that would be performed on an lvalue of type T2 when
12292 /// binding a reference of type T1 to it, as determined when evaluating
12293 /// whether T1 is reference-compatible with T2.
12297 Function = 0x4,
12299 ObjC = 0x10,
12301
12302 LLVM_MARK_AS_BITMASK_ENUM(/*LargestValue=*/ObjCLifetime)
12303 };
12304 };
12306
12309 ReferenceConversions *Conv = nullptr);
12310
12313 ExprValueKind &VK, CXXCastPath &Path);
12314
12315 /// Force an expression with unknown-type to an expression of the
12316 /// given type.
12318
12319 /// Type-check an expression that's being passed to an
12320 /// __unknown_anytype parameter.
12322 Expr *result, QualType &paramType);
12323
12324 // CheckMatrixCast - Check type constraints for matrix casts.
12325 // We allow casting between matrixes of the same dimensions i.e. when they
12326 // have the same number of rows and column. Returns true if the cast is
12327 // invalid.
12328 bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy,
12329 CastKind &Kind);
12330
12331 // CheckVectorCast - check type constraints for vectors.
12332 // Since vectors are an extension, there are no C standard reference for this.
12333 // We allow casting between vectors and integer datatypes of the same size.
12334 // returns true if the cast is invalid
12335 bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty,
12336 CastKind &Kind);
12337
12338 /// Prepare `SplattedExpr` for a vector splat operation, adding
12339 /// implicit casts if necessary.
12340 ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr);
12341
12342 // CheckExtVectorCast - check type constraints for extended vectors.
12343 // Since vectors are an extension, there are no C standard reference for this.
12344 // We allow casting between vectors and integer datatypes of the same size,
12345 // or vectors and the element type of that vector.
12346 // returns the cast expr
12348 CastKind &Kind);
12349
12351 SourceLocation LParenLoc,
12352 Expr *CastExpr,
12353 SourceLocation RParenLoc);
12354
12356
12357 /// Checks for invalid conversions and casts between
12358 /// retainable pointers and other pointer kinds for ARC and Weak.
12360 QualType castType, Expr *&op,
12362 bool Diagnose = true,
12363 bool DiagnoseCFAudited = false,
12364 BinaryOperatorKind Opc = BO_PtrMemD
12365 );
12366
12369
12371 QualType ExprType);
12372
12373 /// checkRetainCycles - Check whether an Objective-C message send
12374 /// might create an obvious retain cycle.
12376 void checkRetainCycles(Expr *receiver, Expr *argument);
12377 void checkRetainCycles(VarDecl *Var, Expr *Init);
12378
12379 /// checkUnsafeAssigns - Check whether +1 expr is being assigned
12380 /// to weak/__unsafe_unretained type.
12381 bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS);
12382
12383 /// checkUnsafeExprAssigns - Check whether +1 expr is being assigned
12384 /// to weak/__unsafe_unretained expression.
12385 void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS);
12386
12387 /// CheckMessageArgumentTypes - Check types in an Obj-C message send.
12388 /// \param Method - May be null.
12389 /// \param [out] ReturnType - The return type of the send.
12390 /// \return true iff there were any incompatible types.
12391 bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType,
12392 MultiExprArg Args, Selector Sel,
12393 ArrayRef<SourceLocation> SelectorLocs,
12394 ObjCMethodDecl *Method, bool isClassMessage,
12395 bool isSuperMessage, SourceLocation lbrac,
12396 SourceLocation rbrac, SourceRange RecRange,
12397 QualType &ReturnType, ExprValueKind &VK);
12398
12399 /// Determine the result of a message send expression based on
12400 /// the type of the receiver, the method expected to receive the message,
12401 /// and the form of the message send.
12402 QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType,
12403 ObjCMethodDecl *Method, bool isClassMessage,
12404 bool isSuperMessage);
12405
12406 /// If the given expression involves a message send to a method
12407 /// with a related result type, emit a note describing what happened.
12408 void EmitRelatedResultTypeNote(const Expr *E);
12409
12410 /// Given that we had incompatible pointer types in a return
12411 /// statement, check whether we're in a method with a related result
12412 /// type, and if so, emit a note describing what happened.
12414
12416 Decl *ConditionVar;
12417 FullExprArg Condition;
12418 bool Invalid;
12419 bool HasKnownValue;
12420 bool KnownValue;
12421
12422 friend class Sema;
12423 ConditionResult(Sema &S, Decl *ConditionVar, FullExprArg Condition,
12424 bool IsConstexpr)
12425 : ConditionVar(ConditionVar), Condition(Condition), Invalid(false),
12426 HasKnownValue(IsConstexpr && Condition.get() &&
12427 !Condition.get()->isValueDependent()),
12428 KnownValue(HasKnownValue &&
12429 !!Condition.get()->EvaluateKnownConstInt(S.Context)) {}
12430 explicit ConditionResult(bool Invalid)
12431 : ConditionVar(nullptr), Condition(nullptr), Invalid(Invalid),
12432 HasKnownValue(false), KnownValue(false) {}
12433
12434 public:
12436 bool isInvalid() const { return Invalid; }
12437 std::pair<VarDecl *, Expr *> get() const {
12438 return std::make_pair(cast_or_null<VarDecl>(ConditionVar),
12439 Condition.get());
12440 }
12442 if (!HasKnownValue)
12443 return None;
12444 return KnownValue;
12445 }
12446 };
12448
12449 enum class ConditionKind {
12450 Boolean, ///< A boolean condition, from 'if', 'while', 'for', or 'do'.
12451 ConstexprIf, ///< A constant boolean condition from 'if constexpr'.
12452 Switch ///< An integral condition for a 'switch' statement.
12453 };
12457
12458 ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr,
12459 ConditionKind CK, bool MissingOK = false);
12460
12461 ConditionResult ActOnConditionVariable(Decl *ConditionVar,
12462 SourceLocation StmtLoc,
12463 ConditionKind CK);
12464
12466
12468 SourceLocation StmtLoc,
12469 ConditionKind CK);
12471
12472 /// CheckBooleanCondition - Diagnose problems involving the use of
12473 /// the given expression as a boolean condition (e.g. in an if
12474 /// statement). Also performs the standard function and array
12475 /// decays, possibly changing the input variable.
12476 ///
12477 /// \param Loc - A location associated with the condition, e.g. the
12478 /// 'if' keyword.
12479 /// \return true iff there were any errors
12481 bool IsConstexpr = false);
12482
12483 /// ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression
12484 /// found in an explicit(bool) specifier.
12486
12487 /// tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
12488 /// Returns true if the explicit specifier is now resolved.
12490
12491 /// DiagnoseAssignmentAsCondition - Given that an expression is
12492 /// being used as a boolean condition, warn if it's an assignment.
12494
12495 /// Redundant parentheses over an equality comparison can indicate
12496 /// that the user intended an assignment used as condition.
12498
12499 /// CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
12500 ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr = false);
12501
12502 /// ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have
12503 /// the specified width and sign. If an overflow occurs, detect it and emit
12504 /// the specified diagnostic.
12505 void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal,
12506 unsigned NewWidth, bool NewSign,
12507 SourceLocation Loc, unsigned DiagID);
12508
12509 /// Checks that the Objective-C declaration is declared in the global scope.
12510 /// Emits an error and marks the declaration as invalid if it's not declared
12511 /// in the global scope.
12512 bool CheckObjCDeclScope(Decl *D);
12513
12514 /// Abstract base class used for diagnosing integer constant
12515 /// expression violations.
12517 public:
12519
12521
12522 virtual SemaDiagnosticBuilder
12525 SourceLocation Loc) = 0;
12528 };
12529
12534
12535 /// VerifyIntegerConstantExpression - Verifies that an expression is an ICE,
12536 /// and reports the appropriate diagnostics. Returns false on success.
12537 /// Can optionally return the value of the expression.
12539 VerifyICEDiagnoser &Diagnoser,
12540 AllowFoldKind CanFold = NoFold);
12542 unsigned DiagID,
12543 AllowFoldKind CanFold = NoFold);
12545 llvm::APSInt *Result = nullptr,
12546 AllowFoldKind CanFold = NoFold);
12548 AllowFoldKind CanFold = NoFold) {
12549 return VerifyIntegerConstantExpression(E, nullptr, CanFold);
12550 }
12551
12552 /// VerifyBitField - verifies that a bit field expression is an ICE and has
12553 /// the correct width, and that the field type is valid.
12554 /// Returns false on success.
12556 QualType FieldTy, bool IsMsStruct, Expr *BitWidth);
12557
12558private:
12559 unsigned ForceCUDAHostDeviceDepth = 0;
12560
12561public:
12562 /// Increments our count of the number of times we've seen a pragma forcing
12563 /// functions to be __host__ __device__. So long as this count is greater
12564 /// than zero, all functions encountered will be __host__ __device__.
12566
12567 /// Decrements our count of the number of times we've seen a pragma forcing
12568 /// functions to be __host__ __device__. Returns false if the count is 0
12569 /// before incrementing, so you can emit an error.
12571
12572 /// Diagnostics that are emitted only if we discover that the given function
12573 /// must be codegen'ed. Because handling these correctly adds overhead to
12574 /// compilation, this is currently only enabled for CUDA compilations.
12575 llvm::DenseMap<CanonicalDeclPtr<FunctionDecl>,
12576 std::vector<PartialDiagnosticAt>>
12578
12579 /// A pair of a canonical FunctionDecl and a SourceLocation. When used as the
12580 /// key in a hashtable, both the FD and location are hashed.
12585
12586 /// FunctionDecls and SourceLocations for which CheckCUDACall has emitted a
12587 /// (maybe deferred) "bad call" diagnostic. We use this to avoid emitting the
12588 /// same deferred diag twice.
12590
12591 /// An inverse call graph, mapping known-emitted functions to one of their
12592 /// known-emitted callers (plus the location of the call).
12593 ///
12594 /// Functions that we can tell a priori must be emitted aren't added to this
12595 /// map.
12596 llvm::DenseMap</* Callee = */ CanonicalDeclPtr<FunctionDecl>,
12597 /* Caller = */ FunctionDeclAndLoc>
12599
12600 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
12601 /// context is "used as device code".
12602 ///
12603 /// - If CurContext is a __host__ function, does not emit any diagnostics
12604 /// unless \p EmitOnBothSides is true.
12605 /// - If CurContext is a __device__ or __global__ function, emits the
12606 /// diagnostics immediately.
12607 /// - If CurContext is a __host__ __device__ function and we are compiling for
12608 /// the device, creates a diagnostic which is emitted if and when we realize
12609 /// that the function will be codegen'ed.
12610 ///
12611 /// Example usage:
12612 ///
12613 /// // Variable-length arrays are not allowed in CUDA device code.
12614 /// if (CUDADiagIfDeviceCode(Loc, diag::err_cuda_vla) << CurrentCUDATarget())
12615 /// return ExprError();
12616 /// // Otherwise, continue parsing as normal.
12618 unsigned DiagID);
12619
12620 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
12621 /// context is "used as host code".
12622 ///
12623 /// Same as CUDADiagIfDeviceCode, with "host" and "device" switched.
12625
12626 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
12627 /// context is "used as device code".
12628 ///
12629 /// - If CurContext is a `declare target` function or it is known that the
12630 /// function is emitted for the device, emits the diagnostics immediately.
12631 /// - If CurContext is a non-`declare target` function and we are compiling
12632 /// for the device, creates a diagnostic which is emitted if and when we
12633 /// realize that the function will be codegen'ed.
12634 ///
12635 /// Example usage:
12636 ///
12637 /// // Variable-length arrays are not allowed in NVPTX device code.
12638 /// if (diagIfOpenMPDeviceCode(Loc, diag::err_vla_unsupported))
12639 /// return ExprError();
12640 /// // Otherwise, continue parsing as normal.
12642 diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD);
12643
12644 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
12645 /// context is "used as host code".
12646 ///
12647 /// - If CurContext is a `declare target` function or it is known that the
12648 /// function is emitted for the host, emits the diagnostics immediately.
12649 /// - If CurContext is a non-host function, just ignore it.
12650 ///
12651 /// Example usage:
12652 ///
12653 /// // Variable-length arrays are not allowed in NVPTX device code.
12654 /// if (diagIfOpenMPHostode(Loc, diag::err_vla_unsupported))
12655 /// return ExprError();
12656 /// // Otherwise, continue parsing as normal.
12658 unsigned DiagID, FunctionDecl *FD);
12659
12660 SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID,
12661 FunctionDecl *FD = nullptr);
12663 const PartialDiagnostic &PD,
12664 FunctionDecl *FD = nullptr) {
12665 return targetDiag(Loc, PD.getDiagID(), FD) << PD;
12666 }
12667
12668 /// Check if the type is allowed to be used for the current target.
12670 ValueDecl *D = nullptr);
12671
12679
12680 /// Determines whether the given function is a CUDA device/host/kernel/etc.
12681 /// function.
12682 ///
12683 /// Use this rather than examining the function's attributes yourself -- you
12684 /// will get it wrong. Returns CFT_Host if D is null.
12686 bool IgnoreImplicitHDAttr = false);
12688
12690 CVT_Device, /// Emitted on device side with a shadow variable on host side
12691 CVT_Host, /// Emitted on host side only
12692 CVT_Both, /// Emitted on both sides with different addresses
12693 CVT_Unified, /// Emitted as a unified address, e.g. managed variables
12694 };
12695 /// Determines whether the given variable is emitted on host or device side.
12697
12698 /// Gets the CUDA target for the current context.
12700 return IdentifyCUDATarget(dyn_cast<FunctionDecl>(CurContext));
12701 }
12702
12703 static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D);
12704
12705 // CUDA function call preference. Must be ordered numerically from
12706 // worst to best.
12708 CFP_Never, // Invalid caller/callee combination.
12709 CFP_WrongSide, // Calls from host-device to host or device
12710 // function that do not match current compilation
12711 // mode.
12712 CFP_HostDevice, // Any calls to host/device functions.
12713 CFP_SameSide, // Calls from host-device to host or device
12714 // function matching current compilation mode.
12715 CFP_Native, // host-to-host or device-to-device calls.
12716 };
12717
12718 /// Identifies relative preference of a given Caller/Callee
12719 /// combination, based on their host/device attributes.
12720 /// \param Caller function which needs address of \p Callee.
12721 /// nullptr in case of global context.
12722 /// \param Callee target function
12723 ///
12724 /// \returns preference value for particular Caller/Callee combination.
12726 const FunctionDecl *Callee);
12727
12728 /// Determines whether Caller may invoke Callee, based on their CUDA
12729 /// host/device attributes. Returns false if the call is not allowed.
12730 ///
12731 /// Note: Will return true for CFP_WrongSide calls. These may appear in
12732 /// semantically correct CUDA programs, but only if they're never codegen'ed.
12734 const FunctionDecl *Callee) {
12735 return IdentifyCUDAPreference(Caller, Callee) != CFP_Never;
12736 }
12737
12738 /// May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD,
12739 /// depending on FD and the current compilation settings.
12741 const LookupResult &Previous);
12742
12743 /// May add implicit CUDAConstantAttr attribute to VD, depending on VD
12744 /// and current compilation settings.
12746
12747public:
12748 /// Check whether we're allowed to call Callee from the current context.
12749 ///
12750 /// - If the call is never allowed in a semantically-correct program
12751 /// (CFP_Never), emits an error and returns false.
12752 ///
12753 /// - If the call is allowed in semantically-correct programs, but only if
12754 /// it's never codegen'ed (CFP_WrongSide), creates a deferred diagnostic to
12755 /// be emitted if and when the caller is codegen'ed, and returns true.
12756 ///
12757 /// Will only create deferred diagnostics for a given SourceLocation once,
12758 /// so you can safely call this multiple times without generating duplicate
12759 /// deferred errors.
12760 ///
12761 /// - Otherwise, returns true without emitting any diagnostics.
12762 bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee);
12763
12765
12766 /// Set __device__ or __host__ __device__ attributes on the given lambda
12767 /// operator() method.
12768 ///
12769 /// CUDA lambdas by default is host device function unless it has explicit
12770 /// host or device attribute.
12771 void CUDASetLambdaAttrs(CXXMethodDecl *Method);
12772
12773 /// Finds a function in \p Matches with highest calling priority
12774 /// from \p Caller context and erases all functions with lower
12775 /// calling priority.
12777 const FunctionDecl *Caller,
12778 SmallVectorImpl<std::pair<DeclAccessPair, FunctionDecl *>> &Matches);
12779
12780 /// Given a implicit special member, infer its CUDA target from the
12781 /// calls it needs to make to underlying base/field special members.
12782 /// \param ClassDecl the class for which the member is being created.
12783 /// \param CSM the kind of special member.
12784 /// \param MemberDecl the special member itself.
12785 /// \param ConstRHS true if this is a copy operation with a const object on
12786 /// its RHS.
12787 /// \param Diagnose true if this call should emit diagnostics.
12788 /// \return true if there was an error inferring.
12789 /// The result of this call is implicit CUDA target attribute(s) attached to
12790 /// the member declaration.
12792 CXXSpecialMember CSM,
12793 CXXMethodDecl *MemberDecl,
12794 bool ConstRHS,
12795 bool Diagnose);
12796
12797 /// \return true if \p CD can be considered empty according to CUDA
12798 /// (E.2.3.1 in CUDA 7.5 Programming guide).
12801
12802 // \brief Checks that initializers of \p Var satisfy CUDA restrictions. In
12803 // case of error emits appropriate diagnostic and invalidates \p Var.
12804 //
12805 // \details CUDA allows only empty constructors as initializers for global
12806 // variables (see E.2.3.1, CUDA 7.5). The same restriction also applies to all
12807 // __shared__ variables whether they are local or not (they all are implicitly
12808 // static in CUDA). One exception is that CUDA allows constant initializers
12809 // for __constant__ and __device__ variables.
12811
12812 /// Check whether NewFD is a valid overload for CUDA. Emits
12813 /// diagnostics and invalidates NewFD if not.
12815 const LookupResult &Previous);
12816 /// Copies target attributes from the template TD to the function FD.
12818
12819 /// Returns the name of the launch configuration function. This is the name
12820 /// of the function that will be called to configure kernel call, with the
12821 /// parameters specified via <<<>>>.
12822 std::string getCudaConfigureFuncName() const;
12823
12824 /// \name Code completion
12825 //@{
12826 /// Describes the context in which code completion occurs.
12828 /// Code completion occurs at top-level or namespace context.
12830 /// Code completion occurs within a class, struct, or union.
12832 /// Code completion occurs within an Objective-C interface, protocol,
12833 /// or category.
12835 /// Code completion occurs within an Objective-C implementation or
12836 /// category implementation
12838 /// Code completion occurs within the list of instance variables
12839 /// in an Objective-C interface, protocol, category, or implementation.
12841 /// Code completion occurs following one or more template
12842 /// headers.
12844 /// Code completion occurs following one or more template
12845 /// headers within a class.
12847 /// Code completion occurs within an expression.
12849 /// Code completion occurs within a statement, which may
12850 /// also be an expression or a declaration.
12852 /// Code completion occurs at the beginning of the
12853 /// initialization statement (or expression) in a for loop.
12855 /// Code completion occurs within the condition of an if,
12856 /// while, switch, or for statement.
12858 /// Code completion occurs within the body of a function on a
12859 /// recovery path, where we do not have a specific handle on our position
12860 /// in the grammar.
12862 /// Code completion occurs where only a type is permitted.
12864 /// Code completion occurs in a parenthesized expression, which
12865 /// might also be a type cast.
12867 /// Code completion occurs within a sequence of declaration
12868 /// specifiers within a function, method, or block.
12871
12874 ParserCompletionContext CompletionContext);
12875 void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS,
12876 bool AllowNonIdentifiers,
12877 bool AllowNestedNameSpecifiers);
12878
12879 struct CodeCompleteExpressionData;
12881 const CodeCompleteExpressionData &Data);
12882 void CodeCompleteExpression(Scope *S, QualType PreferredType,
12883 bool IsParenthesized = false);
12884 void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase,
12885 SourceLocation OpLoc, bool IsArrow,
12886 bool IsBaseExprStatement,
12887 QualType PreferredType);
12889 QualType PreferredType);
12890 void CodeCompleteTag(Scope *S, unsigned TagSpec);
12893 const VirtSpecifiers *VS = nullptr);
12895 void CodeCompleteCase(Scope *S);
12897 Attribute,
12898 Scope,
12899 None,
12900 };
12904 const IdentifierInfo *Scope = nullptr);
12905 /// Determines the preferred type of the current function argument, by
12906 /// examining the signatures of all possible overloads.
12907 /// Returns null if unknown or ambiguous, or if code completion is off.
12908 ///
12909 /// If the code completion point has been reached, also reports the function
12910 /// signatures that were considered.
12911 ///
12912 /// FIXME: rename to GuessCallArgumentType to reduce confusion.
12914 SourceLocation OpenParLoc);
12916 ArrayRef<Expr *> Args,
12917 SourceLocation OpenParLoc,
12918 bool Braced);
12920 Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy,
12921 ArrayRef<Expr *> ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc,
12922 bool Braced);
12925 void CodeCompleteInitializer(Scope *S, Decl *D);
12926 /// Trigger code completion for a record of \p BaseType. \p InitExprs are
12927 /// expressions in the initializer list seen so far and \p D is the current
12928 /// Designation being parsed.
12929 void CodeCompleteDesignator(const QualType BaseType,
12930 llvm::ArrayRef<Expr *> InitExprs,
12931 const Designation &D);
12932 void CodeCompleteAfterIf(Scope *S, bool IsBracedThen);
12933
12934 void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext,
12935 bool IsUsingDeclaration, QualType BaseType,
12936 QualType PreferredType);
12937 void CodeCompleteUsing(Scope *S);
12943 Decl *Constructor,
12944 ArrayRef<CXXCtorInitializer *> Initializers);
12945
12947 bool AfterAmpersand);
12949
12958 bool IsParameter);
12962 bool AtArgumentExpression);
12965 bool AtArgumentExpression,
12966 bool IsSuper = false);
12967 void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver,
12969 bool AtArgumentExpression,
12970 ObjCInterfaceDecl *Super = nullptr);
12972 DeclGroupPtrTy IterationVar);
12974 ArrayRef<IdentifierInfo *> SelIdents);
12976 ArrayRef<IdentifierLocPair> Protocols);
12980 IdentifierInfo *ClassName,
12981 SourceLocation ClassNameLoc);
12984 IdentifierInfo *ClassName,
12985 SourceLocation ClassNameLoc);
12987 IdentifierInfo *ClassName,
12988 SourceLocation ClassNameLoc);
12991 IdentifierInfo *PropertyName);
12992 void CodeCompleteObjCMethodDecl(Scope *S, Optional<bool> IsInstanceMethod,
12993 ParsedType ReturnType);
12995 bool IsInstanceMethod,
12996 bool AtParameterName,
12997 ParsedType ReturnType,
12998 ArrayRef<IdentifierInfo *> SelIdents);
13000 SourceLocation ClassNameLoc,
13001 bool IsBaseExprStatement);
13002 void CodeCompletePreprocessorDirective(bool InConditional);
13004 void CodeCompletePreprocessorMacroName(bool IsDefinition);
13007 IdentifierInfo *Macro,
13009 unsigned Argument);
13010 void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled);
13014 CodeCompletionTUInfo &CCTUInfo,
13016 //@}
13017
13018 //===--------------------------------------------------------------------===//
13019 // Extra semantic analysis beyond the C type system
13020
13021public:
13023 unsigned ByteNo) const;
13024
13026 FAPK_Fixed, // values to format are fixed (no C-style variadic arguments)
13027 FAPK_Variadic, // values to format are passed as variadic arguments
13028 FAPK_VAList, // values to format are passed in a va_list
13029 };
13030
13031 // Used to grab the relevant information from a FormatAttr and a
13032 // FunctionDeclaration.
13038
13039 static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember,
13040 bool IsVariadic, FormatStringInfo *FSI);
13041
13042private:
13043 void CheckArrayAccess(const Expr *BaseExpr, const Expr *IndexExpr,
13044 const ArraySubscriptExpr *ASE = nullptr,
13045 bool AllowOnePastEnd = true, bool IndexNegated = false);
13046 void CheckArrayAccess(const Expr *E);
13047
13048 bool CheckFunctionCall(FunctionDecl *FDecl, CallExpr *TheCall,
13049 const FunctionProtoType *Proto);
13050 bool CheckObjCMethodCall(ObjCMethodDecl *Method, SourceLocation loc,
13052 bool CheckPointerCall(NamedDecl *NDecl, CallExpr *TheCall,
13053 const FunctionProtoType *Proto);
13054 bool CheckOtherCall(CallExpr *TheCall, const FunctionProtoType *Proto);
13055 void CheckConstructorCall(FunctionDecl *FDecl, QualType ThisType,
13057 const FunctionProtoType *Proto, SourceLocation Loc);
13058
13059 void checkAIXMemberAlignment(SourceLocation Loc, const Expr *Arg);
13060
13061 void CheckArgAlignment(SourceLocation Loc, NamedDecl *FDecl,
13062 StringRef ParamName, QualType ArgTy, QualType ParamTy);
13063
13064 void checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
13065 const Expr *ThisArg, ArrayRef<const Expr *> Args,
13066 bool IsMemberFunction, SourceLocation Loc, SourceRange Range,
13067 VariadicCallType CallType);
13068
13069 bool CheckObjCString(Expr *Arg);
13070 ExprResult CheckOSLogFormatStringArg(Expr *Arg);
13071
13072 ExprResult CheckBuiltinFunctionCall(FunctionDecl *FDecl,
13073 unsigned BuiltinID, CallExpr *TheCall);
13074
13075 bool CheckTSBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13076 CallExpr *TheCall);
13077
13078 void checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD, CallExpr *TheCall);
13079
13080 bool CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall,
13081 unsigned MaxWidth);
13082 bool CheckNeonBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13083 CallExpr *TheCall);
13084 bool CheckMVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13085 bool CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13086 bool CheckCDEBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13087 CallExpr *TheCall);
13088 bool CheckARMCoprocessorImmediate(const TargetInfo &TI, const Expr *CoprocArg,
13089 bool WantCDE);
13090 bool CheckARMBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13091 CallExpr *TheCall);
13092
13093 bool CheckAArch64BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13094 CallExpr *TheCall);
13095 bool CheckBPFBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13096 bool CheckHexagonBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13097 bool CheckHexagonBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
13098 bool CheckMipsBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13099 CallExpr *TheCall);
13100 bool CheckMipsBuiltinCpu(const TargetInfo &TI, unsigned BuiltinID,
13101 CallExpr *TheCall);
13102 bool CheckMipsBuiltinArgument(unsigned BuiltinID, CallExpr *TheCall);
13103 bool CheckSystemZBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13104 bool CheckX86BuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall);
13105 bool CheckX86BuiltinGatherScatterScale(unsigned BuiltinID, CallExpr *TheCall);
13106 bool CheckX86BuiltinTileArguments(unsigned BuiltinID, CallExpr *TheCall);
13107 bool CheckX86BuiltinTileArgumentsRange(CallExpr *TheCall,
13108 ArrayRef<int> ArgNums);
13109 bool CheckX86BuiltinTileDuplicate(CallExpr *TheCall, ArrayRef<int> ArgNums);
13110 bool CheckX86BuiltinTileRangeAndDuplicate(CallExpr *TheCall,
13111 ArrayRef<int> ArgNums);
13112 bool CheckX86BuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13113 CallExpr *TheCall);
13114 bool CheckPPCBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13115 CallExpr *TheCall);
13116 bool CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall);
13117 bool CheckRISCVLMUL(CallExpr *TheCall, unsigned ArgNum);
13118 bool CheckRISCVBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID,
13119 CallExpr *TheCall);
13120
13121 bool SemaBuiltinVAStart(unsigned BuiltinID, CallExpr *TheCall);
13122 bool SemaBuiltinVAStartARMMicrosoft(CallExpr *Call);
13123 bool SemaBuiltinUnorderedCompare(CallExpr *TheCall);
13124 bool SemaBuiltinFPClassification(CallExpr *TheCall, unsigned NumArgs);
13125 bool SemaBuiltinComplex(CallExpr *TheCall);
13126 bool SemaBuiltinVSX(CallExpr *TheCall);
13127 bool SemaBuiltinOSLogFormat(CallExpr *TheCall);
13128 bool SemaValueIsRunOfOnes(CallExpr *TheCall, unsigned ArgNum);
13129
13130public:
13131 // Used by C++ template instantiation.
13134 SourceLocation BuiltinLoc,
13135 SourceLocation RParenLoc);
13136
13137private:
13138 bool SemaBuiltinPrefetch(CallExpr *TheCall);
13139 bool SemaBuiltinAllocaWithAlign(CallExpr *TheCall);
13140 bool SemaBuiltinArithmeticFence(CallExpr *TheCall);
13141 bool SemaBuiltinAssume(CallExpr *TheCall);
13142 bool SemaBuiltinAssumeAligned(CallExpr *TheCall);
13143 bool SemaBuiltinLongjmp(CallExpr *TheCall);
13144 bool SemaBuiltinSetjmp(CallExpr *TheCall);
13145 ExprResult SemaBuiltinAtomicOverloaded(ExprResult TheCallResult);
13146 ExprResult SemaBuiltinNontemporalOverloaded(ExprResult TheCallResult);
13147 ExprResult SemaAtomicOpsOverloaded(ExprResult TheCallResult,
13149 ExprResult SemaBuiltinOperatorNewDeleteOverloaded(ExprResult TheCallResult,
13150 bool IsDelete);
13151 bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
13152 llvm::APSInt &Result);
13153 bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low,
13154 int High, bool RangeIsError = true);
13155 bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
13156 unsigned Multiple);
13157 bool SemaBuiltinConstantArgPower2(CallExpr *TheCall, int ArgNum);
13158 bool SemaBuiltinConstantArgShiftedByte(CallExpr *TheCall, int ArgNum,
13159 unsigned ArgBits);
13160 bool SemaBuiltinConstantArgShiftedByteOrXXFF(CallExpr *TheCall, int ArgNum,
13161 unsigned ArgBits);
13162 bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,
13163 int ArgNum, unsigned ExpectedFieldNum,
13164 bool AllowName);
13165 bool SemaBuiltinARMMemoryTaggingCall(unsigned BuiltinID, CallExpr *TheCall);
13166 bool SemaBuiltinPPCMMACall(CallExpr *TheCall, unsigned BuiltinID,
13167 const char *TypeDesc);
13168
13169 bool CheckPPCMMAType(QualType Type, SourceLocation TypeLoc);
13170
13171 bool SemaBuiltinElementwiseMath(CallExpr *TheCall);
13172 bool PrepareBuiltinElementwiseMathOneArgCall(CallExpr *TheCall);
13173 bool PrepareBuiltinReduceMathOneArgCall(CallExpr *TheCall);
13174
13175 // Matrix builtin handling.
13176 ExprResult SemaBuiltinMatrixTranspose(CallExpr *TheCall,
13177 ExprResult CallResult);
13178 ExprResult SemaBuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
13179 ExprResult CallResult);
13180 ExprResult SemaBuiltinMatrixColumnMajorStore(CallExpr *TheCall,
13181 ExprResult CallResult);
13182
13183public:
13196 static FormatStringType GetFormatStringType(const FormatAttr *Format);
13197
13198 bool FormatStringHasSArg(const StringLiteral *FExpr);
13199
13200 static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx);
13201
13202private:
13203 bool CheckFormatArguments(const FormatAttr *Format,
13204 ArrayRef<const Expr *> Args, bool IsCXXMember,
13205 VariadicCallType CallType, SourceLocation Loc,
13206 SourceRange Range,
13207 llvm::SmallBitVector &CheckedVarArgs);
13208 bool CheckFormatArguments(ArrayRef<const Expr *> Args,
13209 FormatArgumentPassingKind FAPK, unsigned format_idx,
13210 unsigned firstDataArg, FormatStringType Type,
13211 VariadicCallType CallType, SourceLocation Loc,
13212 SourceRange range,
13213 llvm::SmallBitVector &CheckedVarArgs);
13214
13215 void CheckAbsoluteValueFunction(const CallExpr *Call,
13216 const FunctionDecl *FDecl);
13217
13218 void CheckMaxUnsignedZero(const CallExpr *Call, const FunctionDecl *FDecl);
13219
13220 void CheckMemaccessArguments(const CallExpr *Call,
13221 unsigned BId,
13222 IdentifierInfo *FnName);
13223
13224 void CheckStrlcpycatArguments(const CallExpr *Call,
13225 IdentifierInfo *FnName);
13226
13227 void CheckStrncatArguments(const CallExpr *Call,
13228 IdentifierInfo *FnName);
13229
13230 void CheckFreeArguments(const CallExpr *E);
13231
13232 void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
13233 SourceLocation ReturnLoc,
13234 bool isObjCMethod = false,
13235 const AttrVec *Attrs = nullptr,
13236 const FunctionDecl *FD = nullptr);
13237
13238public:
13239 void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS,
13240 BinaryOperatorKind Opcode);
13241
13242private:
13243 void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
13244 void CheckBoolLikeConversion(Expr *E, SourceLocation CC);
13245 void CheckForIntOverflow(Expr *E);
13246 void CheckUnsequencedOperations(const Expr *E);
13247
13248 /// Perform semantic checks on a completed expression. This will either
13249 /// be a full-expression or a default argument expression.
13250 void CheckCompletedExpr(Expr *E, SourceLocation CheckLoc = SourceLocation(),
13251 bool IsConstexpr = false);
13252
13253 void CheckBitFieldInitialization(SourceLocation InitLoc, FieldDecl *Field,
13254 Expr *Init);
13255
13256 /// Check if there is a field shadowing.
13257 void CheckShadowInheritedFields(const SourceLocation &Loc,
13258 DeclarationName FieldName,
13259 const CXXRecordDecl *RD,
13260 bool DeclIsField = true);
13261
13262 /// Check if the given expression contains 'break' or 'continue'
13263 /// statement that produces control flow different from GCC.
13264 void CheckBreakContinueBinding(Expr *E);
13265
13266 /// Check whether receiver is mutable ObjC container which
13267 /// attempts to add itself into the container
13268 void CheckObjCCircularContainer(ObjCMessageExpr *Message);
13269
13270 void CheckTCBEnforcement(const SourceLocation CallExprLoc,
13271 const NamedDecl *Callee);
13272
13273 void AnalyzeDeleteExprMismatch(const CXXDeleteExpr *DE);
13274 void AnalyzeDeleteExprMismatch(FieldDecl *Field, SourceLocation DeleteLoc,
13275 bool DeleteWasArrayForm);
13276public:
13277 /// Register a magic integral constant to be used as a type tag.
13278 void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind,
13279 uint64_t MagicValue, QualType Type,
13280 bool LayoutCompatible, bool MustBeNull);
13281
13284
13289
13291
13292 /// If true, \c Type should be compared with other expression's types for
13293 /// layout-compatibility.
13294 unsigned LayoutCompatible : 1;
13295 unsigned MustBeNull : 1;
13296 };
13297
13298 /// A pair of ArgumentKind identifier and magic value. This uniquely
13299 /// identifies the magic value.
13300 typedef std::pair<const IdentifierInfo *, uint64_t> TypeTagMagicValue;
13301
13302private:
13303 /// A map from magic value to type information.
13304 std::unique_ptr<llvm::DenseMap<TypeTagMagicValue, TypeTagData>>
13305 TypeTagForDatatypeMagicValues;
13306
13307 /// Peform checks on a call of a function with argument_with_type_tag
13308 /// or pointer_with_type_tag attributes.
13309 void CheckArgumentWithTypeTag(const ArgumentWithTypeTagAttr *Attr,
13310 const ArrayRef<const Expr *> ExprArgs,
13311 SourceLocation CallSiteLoc);
13312
13313 /// Check if we are taking the address of a packed field
13314 /// as this may be a problem if the pointer value is dereferenced.
13315 void CheckAddressOfPackedMember(Expr *rhs);
13316
13317 /// The parser's current scope.
13318 ///
13319 /// The parser maintains this state here.
13320 Scope *CurScope;
13321
13322 mutable IdentifierInfo *Ident_super;
13323 mutable IdentifierInfo *Ident___float128;
13324
13325 /// Nullability type specifiers.
13326 IdentifierInfo *Ident__Nonnull = nullptr;
13327 IdentifierInfo *Ident__Nullable = nullptr;
13328 IdentifierInfo *Ident__Nullable_result = nullptr;
13329 IdentifierInfo *Ident__Null_unspecified = nullptr;
13330
13331 IdentifierInfo *Ident_NSError = nullptr;
13332
13333 /// The handler for the FileChanged preprocessor events.
13334 ///
13335 /// Used for diagnostics that implement custom semantic analysis for #include
13336 /// directives, like -Wpragma-pack.
13337 sema::SemaPPCallbacks *SemaPPCallbackHandler;
13338
13339protected:
13340 friend class Parser;
13342 friend class ASTReader;
13343 friend class ASTDeclReader;
13344 friend class ASTWriter;
13345
13346public:
13347 /// Retrieve the keyword associated
13349
13350 /// The struct behind the CFErrorRef pointer.
13352 bool isCFError(RecordDecl *D);
13353
13354 /// Retrieve the identifier "NSError".
13356
13357 /// Retrieve the parser's current scope.
13358 ///
13359 /// This routine must only be used when it is certain that semantic analysis
13360 /// and the parser are in precisely the same context, which is not the case
13361 /// when, e.g., we are performing any kind of template instantiation.
13362 /// Therefore, the only safe places to use this scope are in the parser
13363 /// itself and in routines directly invoked from the parser and *never* from
13364 /// template substitution or instantiation.
13365 Scope *getCurScope() const { return CurScope; }
13366
13368 return CurScope->incrementMSManglingNumber();
13369 }
13370
13373
13375
13379
13381 const DeclContext *DC = getCurLexicalContext();
13382 // A category implicitly has the attribute of the interface.
13383 if (const ObjCCategoryDecl *CatD = dyn_cast<ObjCCategoryDecl>(DC))
13384 DC = CatD->getClassInterface();
13385 return DC;
13386 }
13387
13388 /// Determine the number of levels of enclosing template parameters. This is
13389 /// only usable while parsing. Note that this does not include dependent
13390 /// contexts in which no template parameters have yet been declared, such as
13391 /// in a terse function template or generic lambda before the first 'auto' is
13392 /// encountered.
13393 unsigned getTemplateDepth(Scope *S) const;
13394
13395 /// To be used for checking whether the arguments being passed to
13396 /// function exceeds the number of parameters expected for it.
13397 static bool TooManyArguments(size_t NumParams, size_t NumArgs,
13398 bool PartialOverloading = false) {
13399 // We check whether we're just after a comma in code-completion.
13400 if (NumArgs > 0 && PartialOverloading)
13401 return NumArgs + 1 > NumParams; // If so, we view as an extra argument.
13402 return NumArgs > NumParams;
13403 }
13404
13405 // Emitting members of dllexported classes is delayed until the class
13406 // (including field initializers) is fully parsed.
13409
13410private:
13411 int ParsingClassDepth = 0;
13412
13413 class SavePendingParsedClassStateRAII {
13414 public:
13415 SavePendingParsedClassStateRAII(Sema &S) : S(S) { swapSavedState(); }
13416
13417 ~SavePendingParsedClassStateRAII() {
13418 assert(S.DelayedOverridingExceptionSpecChecks.empty() &&
13419 "there shouldn't be any pending delayed exception spec checks");
13420 assert(S.DelayedEquivalentExceptionSpecChecks.empty() &&
13421 "there shouldn't be any pending delayed exception spec checks");
13422 swapSavedState();
13423 }
13424
13425 private:
13426 Sema &S;
13428 SavedOverridingExceptionSpecChecks;
13430 SavedEquivalentExceptionSpecChecks;
13431
13432 void swapSavedState() {
13433 SavedOverridingExceptionSpecChecks.swap(
13434 S.DelayedOverridingExceptionSpecChecks);
13435 SavedEquivalentExceptionSpecChecks.swap(
13436 S.DelayedEquivalentExceptionSpecChecks);
13437 }
13438 };
13439
13440 /// Helper class that collects misaligned member designations and
13441 /// their location info for delayed diagnostics.
13442 struct MisalignedMember {
13443 Expr *E;
13444 RecordDecl *RD;
13445 ValueDecl *MD;
13446 CharUnits Alignment;
13447
13448 MisalignedMember() : E(), RD(), MD() {}
13449 MisalignedMember(Expr *E, RecordDecl *RD, ValueDecl *MD,
13450 CharUnits Alignment)
13451 : E(E), RD(RD), MD(MD), Alignment(Alignment) {}
13452 explicit MisalignedMember(Expr *E)
13453 : MisalignedMember(E, nullptr, nullptr, CharUnits()) {}
13454
13455 bool operator==(const MisalignedMember &m) { return this->E == m.E; }
13456 };
13457 /// Small set of gathered accesses to potentially misaligned members
13458 /// due to the packed attribute.
13459 SmallVector<MisalignedMember, 4> MisalignedMembers;
13460
13461 /// Adds an expression to the set of gathered misaligned members.
13462 void AddPotentialMisalignedMembers(Expr *E, RecordDecl *RD, ValueDecl *MD,
13463 CharUnits Alignment);
13464
13465public:
13466 /// Diagnoses the current set of gathered accesses. This typically
13467 /// happens at full expression level. The set is cleared after emitting the
13468 /// diagnostics.
13470
13471 /// This function checks if the expression is in the sef of potentially
13472 /// misaligned members and it is converted to some pointer type T with lower
13473 /// or equal alignment requirements. If so it removes it. This is used when
13474 /// we do not want to diagnose such misaligned access (e.g. in conversions to
13475 /// void*).
13476 void DiscardMisalignedMemberAddress(const Type *T, Expr *E);
13477
13478 /// This function calls Action when it determines that E designates a
13479 /// misaligned member due to the packed attribute. This is used to emit
13480 /// local diagnostics like in reference binding.
13482 Expr *E,
13483 llvm::function_ref<void(Expr *, RecordDecl *, FieldDecl *, CharUnits)>
13484 Action);
13485
13486 /// Describes the reason a calling convention specification was ignored, used
13487 /// for diagnostics.
13494 /// Creates a SemaDiagnosticBuilder that emits the diagnostic if the current
13495 /// context is "used as device code".
13496 ///
13497 /// - If CurLexicalContext is a kernel function or it is known that the
13498 /// function will be emitted for the device, emits the diagnostics
13499 /// immediately.
13500 /// - If CurLexicalContext is a function and we are compiling
13501 /// for the device, but we don't know that this function will be codegen'ed
13502 /// for devive yet, creates a diagnostic which is emitted if and when we
13503 /// realize that the function will be codegen'ed.
13504 ///
13505 /// Example usage:
13506 ///
13507 /// Diagnose __float128 type usage only from SYCL device code if the current
13508 /// target doesn't support it
13509 /// if (!S.Context.getTargetInfo().hasFloat128Type() &&
13510 /// S.getLangOpts().SYCLIsDevice)
13511 /// SYCLDiagIfDeviceCode(Loc, diag::err_type_unsupported) << "__float128";
13512 SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc,
13513 unsigned DiagID);
13514
13515 /// Check whether we're allowed to call Callee from the current context.
13516 ///
13517 /// - If the call is never allowed in a semantically-correct program
13518 /// emits an error and returns false.
13519 ///
13520 /// - If the call is allowed in semantically-correct programs, but only if
13521 /// it's never codegen'ed, creates a deferred diagnostic to be emitted if
13522 /// and when the caller is codegen'ed, and returns true.
13523 ///
13524 /// - Otherwise, returns true without emitting any diagnostics.
13525 ///
13526 /// Adds Callee to DeviceCallGraph if we don't know if its caller will be
13527 /// codegen'ed yet.
13531 ValueDecl *DeclToCheck);
13532};
13533
13534/// RAII object that enters a new expression evaluation context.
13536 Sema &Actions;
13537 bool Entered = true;
13538
13539public:
13541 Sema &Actions, Sema::ExpressionEvaluationContext NewContext,
13542 Decl *LambdaContextDecl = nullptr,
13545 bool ShouldEnter = true)
13546 : Actions(Actions), Entered(ShouldEnter) {
13547 if (Entered)
13548 Actions.PushExpressionEvaluationContext(NewContext, LambdaContextDecl,
13549 ExprContext);
13550 }
13560
13563 bool ShouldEnter = true)
13564 : Actions(Actions), Entered(false) {
13565 // In C++11 onwards, narrowing checks are performed on the contents of
13566 // braced-init-lists, even when they occur within unevaluated operands.
13567 // Therefore we still need to instantiate constexpr functions used in such
13568 // a context.
13569 if (ShouldEnter && Actions.isUnevaluatedContext() &&
13570 Actions.getLangOpts().CPlusPlus11) {
13571 Actions.PushExpressionEvaluationContext(
13572 Sema::ExpressionEvaluationContext::UnevaluatedList);
13573 Entered = true;
13574 }
13575 }
13576
13578 if (Entered)
13580 }
13581};
13582
13583DeductionFailureInfo
13585 sema::TemplateDeductionInfo &Info);
13586
13587/// Contains a late templated function.
13588/// Will be parsed at the end of the translation unit, used by Sema & Parser.
13591 /// The template function declaration to be late parsed.
13593};
13594
13595template <>
13597 PragmaMsStackAction Action,
13598 llvm::StringRef StackSlotLabel,
13600
13601std::unique_ptr<sema::RISCVIntrinsicManager>
13603} // end namespace clang
13604
13605namespace llvm {
13606// Hash a FunctionDeclAndLoc by looking at both its FunctionDecl and its
13607// SourceLocation.
13608template <> struct DenseMapInfo<clang::Sema::FunctionDeclAndLoc> {
13610 using FDBaseInfo = DenseMapInfo<clang::CanonicalDeclPtr<clang::FunctionDecl>>;
13611
13613 return {FDBaseInfo::getEmptyKey(), clang::SourceLocation()};
13614 }
13615
13617 return {FDBaseInfo::getTombstoneKey(), clang::SourceLocation()};
13618 }
13619
13620 static unsigned getHashValue(const FunctionDeclAndLoc &FDL) {
13621 return hash_combine(FDBaseInfo::getHashValue(FDL.FD),
13622 FDL.Loc.getHashValue());
13623 }
13624
13625 static bool isEqual(const FunctionDeclAndLoc &LHS,
13626 const FunctionDeclAndLoc &RHS) {
13627 return LHS.FD == RHS.FD && LHS.Loc == RHS.Loc;
13628 }
13629};
13630} // namespace llvm
13631
13632#endif
This file provides AST data structures related to concepts.
#define V(N, I)
int Id
Definition ASTDiff.cpp:191
Forward declaration of all AST node types.
MatchType Type
StringRef P
#define SM(sm)
Definition Cuda.cpp:81
Provides LLVM's BitmaskEnum facility to enumeration types declared in namespace clang.
auto * N
Defines enum values for all the target-independent builtin functions.
llvm::APSInt APSInt
static CompilationDatabasePluginRegistry::Add< FixedCompilationDatabasePlugin > X("fixed-compilation-database", "Reads plain-text flags file")
This file defines the classes used to store parsed information about declaration-specifiers and decla...
Defines the C++ template declaration subclasses.
Defines the clang::Expr interface and subclasses for C++ expressions.
Defines Expressions and AST nodes for C++2a concepts.
Defines enumerations for expression traits intrinsics.
Token Tok
The Token.
FormatToken * Previous
The previous token in the unwrapped line.
unsigned Offset
Definition Format.cpp:2579
bool IsStatic
Definition Format.cpp:2589
StringRef Identifier
Definition Format.cpp:2585
Defines the clang::Module class, which describes a module in the source code.
Defines the clang::OpenCLOptions class.
Defines some OpenMP-specific enums and functions.
AccessResult
A copy of Sema's enum without AR_delayed.
CastType
Definition SemaCast.cpp:46
Sema::AllowedExplicit AllowedExplicit
Defines various enumerations that describe declaration and type specifiers.
This file defines OpenMP AST classes for executable directives and clauses.
Defines the clang::TemplateNameKind enum.
Defines the clang::TypeLoc interface and its subclasses.
Allows QualTypes to be sorted and hence used in maps and sets.
Defines enumerations for the type traits support.
TypePropertyCache< Private > Cache
Definition Type.cpp:3885
SourceLocation Begin
std::string Label
A class for storing results from argument-dependent lookup.
Definition Lookup.h:823
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat],...
Definition APValue.h:122
ASTConsumer - This is an abstract interface that should be implemented by clients that read ASTs.
Definition ASTConsumer.h:33
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition ASTContext.h:209
CanQualType BoolTy
CanQualType IntTy
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
Reads an AST files chain containing the contents of a translation unit.
Definition ASTReader.h:348
Writes an AST file containing the contents of a translation unit.
Definition ASTWriter.h:86
Represents an access specifier followed by colon ':'.
Definition DeclCXX.h:86
bool isInvalid() const
Definition Ownership.h:165
PtrTy get() const
Definition Ownership.h:169
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
Definition Expr.h:2645
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition Type.h:2955
ArraySizeModifier
Capture whether this is a normal array (e.g.
Definition Type.h:2961
Attr - This represents one attribute.
Definition Attr.h:41
Syntax
The style used to specify an attribute.
An attributed type is a type to which a type attribute has been applied.
Definition Type.h:4761
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
Definition Type.h:5107
Represents a C++ declaration that introduces decls from somewhere else.
Definition DeclCXX.h:3317
A binding in a decomposition declaration.
Definition DeclCXX.h:3992
Represents a block literal declaration, which is like an unnamed FunctionDecl.
Definition Decl.h:4219
Represents a path from a specific derived class (which is not represented as part of the path) to a p...
BasePaths - Represents the set of paths from a derived class to one of its (direct or indirect) bases...
Represents a base class of a C++ class.
Definition DeclCXX.h:146
Represents a C++ constructor within a class.
Definition DeclCXX.h:2437
Represents a C++ conversion function within a class.
Definition DeclCXX.h:2764
Represents a C++ base or member initializer.
Definition DeclCXX.h:2205
Represents a delete expression for memory deallocation and destructor calls, e.g.
Definition ExprCXX.h:2415
Represents a C++ destructor within a class.
Definition DeclCXX.h:2701
Represents a static or instance method of a struct/union/class.
Definition DeclCXX.h:1981
Represents a C++ struct/union/class.
Definition DeclCXX.h:254
Represents a C++ nested-name-specifier or a global scope specifier.
Definition DeclSpec.h:64
Represents the this expression in C++.
Definition ExprCXX.h:1142
CXXTryStmt - A C++ try block, including all handlers.
Definition StmtCXX.h:69
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2801
A wrapper class around a pointer that always points to its canonical declaration.
Represents the body of a CapturedStmt, and serves as its DeclContext.
Definition Decl.h:4411
CaseStmt - Represent a case statement.
Definition Stmt.h:1601
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition Expr.h:3475
CharUnits - This is an opaque type for sizes expressed in character units.
Definition CharUnits.h:38
Declaration of a class template.
Represents a class template specialization, which refers to a class template with a given set of temp...
Abstract interface for a consumer of code-completion information.
An allocator used specifically for the purpose of code completion.
Declaration of a C++2a concept.
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:28
Represents a shadow constructor declaration introduced into a class by a C++11 using-declaration that...
Definition DeclCXX.h:3498
Base class for callback objects used by Sema::CorrectTypo to check the validity of a potential typo c...
The information about the darwin SDK that was used during this compilation.
A POD class for pairing a NamedDecl* with an access specifier.
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
The results of name lookup within a DeclContext.
Definition DeclBase.h:1323
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition DeclBase.h:1378
A reference to a declared variable, function, enum, etc.
Definition Expr.h:1227
Captures information about "declaration specifiers".
Definition DeclSpec.h:229
Decl - This represents one declaration (or definition), e.g.
Definition DeclBase.h:83
bool isUnconditionallyVisible() const
Determine whether this declaration is definitely visible to name lookup, independent of whether the o...
Definition DeclBase.h:813
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition DeclBase.h:797
The name of a declaration.
Represents a ValueDecl that came out of a declarator.
Definition Decl.h:726
Information about one declarator, including the parsed type information and the identifier.
Definition DeclSpec.h:1805
A decomposition declaration.
Definition DeclCXX.h:4051
A dependently-generated diagnostic.
Designation - Represent a full designation, which is a sequence of designators.
Definition Designator.h:185
A little helper class used to produce diagnostics.
void Clear() const
Clear out the current diagnostic.
bool isActive() const
Determine whether this diagnostic is still active.
Concrete class used by the front-end to report problems and issues.
Definition Diagnostic.h:192
void setLastDiagnosticIgnored(bool Ignored)
Pretend that the last diagnostic issued was ignored, so any subsequent notes will be suppressed,...
Definition Diagnostic.h:756
RAII object that enters a new expression evaluation context.
Definition Sema.h:13535
EnterExpressionEvaluationContext(Sema &Actions, InitListTag, bool ShouldEnter=true)
Definition Sema.h:13562
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Sema::ReuseLambdaContextDecl_t, Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext=Sema::ExpressionEvaluationContextRecord::EK_Other)
Definition Sema.h:13551
EnterExpressionEvaluationContext(Sema &Actions, Sema::ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext=Sema::ExpressionEvaluationContextRecord::EK_Other, bool ShouldEnter=true)
Definition Sema.h:13540
An instance of this object exists for each enum constant that is defined.
Definition Decl.h:3088
Represents an enum.
Definition Decl.h:3646
Store information needed for an explicit specifier.
Definition DeclCXX.h:1828
Represents a C++ Modules TS module export declaration.
Definition Decl.h:4603
The return type of classify().
Definition Expr.h:323
This represents one expression.
Definition Expr.h:109
NullPointerConstantKind
Enumeration used to describe the kind of Null pointer constant returned from isNullPointerConstant().
Definition Expr.h:757
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
Definition Expr.cpp:247
An abstract interface that should be implemented by external AST sources that also provide informatio...
virtual void ReadTentativeDefinitions(SmallVectorImpl< VarDecl * > &TentativeDefs)
Read the set of tentative definitions known to the external Sema source.
virtual void ReadUnusedFileScopedDecls(SmallVectorImpl< const DeclaratorDecl * > &Decls)
Read the set of unused file-scope declarations known to the external Sema source.
virtual void ReadExtVectorDecls(SmallVectorImpl< TypedefNameDecl * > &Decls)
Read the set of ext_vector type declarations known to the external Sema source.
virtual void ReadDelegatingConstructors(SmallVectorImpl< CXXConstructorDecl * > &Decls)
Read the set of delegating constructors known to the external Sema source.
Represents difference between two FPOptions values.
Represents a member of a struct/union/class.
Definition Decl.h:2873
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A mapping from file IDs to a record of whether we've seen nullability information in that file.
Definition Sema.h:264
FileNullability & operator[](FileID file)
Definition Sema.h:275
FileNullability Nullability
Definition Sema.h:271
Annotates a diagnostic with some code that should be inserted, removed, or replaced to fix the proble...
Definition Diagnostic.h:71
FriendDecl - Represents the declaration of a friend entity, which can be a function,...
Definition DeclFriend.h:55
Represents a function declaration or definition.
Definition Decl.h:1874
Represents a reference to a function parameter pack or init-capture pack that has been substituted bu...
Definition ExprCXX.h:4399
Represents a prototype with parameter type info, e.g.
Definition Type.h:3962
Declaration of a template function.
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
Definition Type.h:3644
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition Type.h:3618
One of these records is kept for each identifier that is lexed.
IdentifierResolver - Keeps track of shadowed decls on enclosing scopes.
ImplicitConversionSequence - Represents an implicit conversion sequence, which may be a standard conv...
Definition Overload.h:518
Represents a field injected from an anonymous union/struct into the parent scope.
Definition Decl.h:3128
Describes an C or C++ initializer list.
Definition Expr.h:4791
Describes the kind of initialization being performed, along with location information for tokens rela...
Describes the sequence of initializations required to initialize a given object or reference with a s...
Describes an entity that is being initialized.
Represents the declaration of a label.
Definition Decl.h:494
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition LangOptions.h:78
FPExceptionModeKind
Possible floating point exception behavior.
FPEvalMethodKind
Possible float expression evaluation method choices.
Represents a lazily-loaded vector of data.
A stack-allocated class that identifies which local variable declaration instantiations are present i...
Definition Template.h:304
Represents the results of name lookup.
Definition Lookup.h:46
A global _GUID constant.
Definition DeclCXX.h:4174
An instance of this class represents the declaration of a property member.
Definition DeclCXX.h:4120
Encapsulates the data about a macro definition (e.g.
Definition MacroInfo.h:39
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
Definition ExprCXX.h:4479
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition Expr.h:3168
Abstract interface for a module loader.
Describes a module or submodule.
Definition Module.h:96
bool isModulePurview() const
Does this Module scope describe part of the purview of a named C++ module?
Definition Module.h:161
Data structure that captures multiple levels of template argument lists for use in template instantia...
Definition Template.h:75
static const unsigned NumNSNumberLiteralMethods
Definition NSAPI.h:191
This represents a decl that may have a name.
Definition Decl.h:247
bool isExternallyDeclarable() const
Determine whether this declaration can be redeclared in a different translation unit.
Definition Decl.h:411
Represent a C++ namespace.
Definition Decl.h:542
A C++ nested-name-specifier augmented with source location information.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
This is a basic class for representing single OpenMP clause.
This represents '#pragma omp declare reduction ...' directive.
Definition DeclOpenMP.h:171
This represents '#pragma omp requires...' directive.
Definition DeclOpenMP.h:416
This represents '#pragma omp threadprivate ...' directive.
Definition DeclOpenMP.h:110
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
ObjCCategoryDecl - Represents a category declaration.
Definition DeclObjC.h:2276
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration.
Definition DeclObjC.h:2495
ObjCContainerDecl - Represents a container for method declarations.
Definition DeclObjC.h:944
Captures information about "declaration specifiers" specific to Objective-C.
Definition DeclSpec.h:823
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition DeclObjC.h:2548
Represents an ObjC class declaration.
Definition DeclObjC.h:1151
ObjCIvarDecl - Represents an ObjC instance variable.
Definition DeclObjC.h:1923
ObjCList - This is a simple template class used to hold various lists of decls etc,...
Definition Sema.h:161
An expression that sends a message to the given Objective-C object or class.
Definition ExprObjC.h:942
ObjCMethodDecl - Represents an instance or class method declaration.
Definition DeclObjC.h:139
Represents a pointer to an Objective C object.
Definition Type.h:6207
Represents a class type in Objective C.
Definition Type.h:5952
Represents one property declaration in an Objective-C interface.
Definition DeclObjC.h:732
Represents an Objective-C protocol declaration.
Definition DeclObjC.h:2053
Represents the declaration of an Objective-C type parameter.
Definition DeclObjC.h:582
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition DeclObjC.h:661
Wrapper for void* pointer.
Definition Ownership.h:50
static OpaquePtr make(QualType P)
Definition Ownership.h:60
OpenCL supported extensions and optional core features.
OverloadCandidateSet - A set of overload candidates, used in C++ overload resolution (C++ 13....
Definition Overload.h:939
A reference to an overloaded function set, either an UnresolvedLookupExpr or an UnresolvedMemberExpr.
Definition ExprCXX.h:2897
ParenExpr - This represents a parethesized expression, e.g.
Definition Expr.h:2112
Represents a parameter to a function.
Definition Decl.h:1680
ParsedAttr - Represents a syntactic attribute.
Definition ParsedAttr.h:237
ParsedAttributes - A collection of parsed attributes.
Represents the parsed form of a C++ template argument.
Parser - This implements a parser for the C family of languages.
Definition Parser.h:60
void Emit(const DiagnosticBuilder &DB) const
Tracks expected type during expression parsing, for use in code completion.
Definition Sema.h:296
void enterFunctionArgument(SourceLocation Tok, llvm::function_ref< QualType()> ComputeType)
Computing a type for the function argument may require running overloading, so we postpone its comput...
void enterCondition(Sema &S, SourceLocation Tok)
void enterTypeCast(SourceLocation Tok, QualType CastType)
Handles all type casts, including C-style cast, C++ casts, etc.
void enterMemAccess(Sema &S, SourceLocation Tok, Expr *Base)
void enterSubscript(Sema &S, SourceLocation Tok, Expr *LHS)
void enterUnary(Sema &S, SourceLocation Tok, tok::TokenKind OpKind, SourceLocation OpLoc)
void enterReturn(Sema &S, SourceLocation Tok)
void enterDesignatedInitializer(SourceLocation Tok, QualType BaseType, const Designation &D)
Handles e.g. BaseType{ .D = Tok...
void enterBinary(Sema &S, SourceLocation Tok, Expr *LHS, tok::TokenKind Op)
void enterParenExpr(SourceLocation Tok, SourceLocation LParLoc)
PreferredTypeBuilder(bool Enabled)
Definition Sema.h:298
void enterVariableInit(SourceLocation Tok, Decl *D)
QualType get(SourceLocation Tok) const
Get the expected type associated with this location, if any.
Definition Sema.h:333
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Stores the type being destroyed by a pseudo-destructor expression.
Definition ExprCXX.h:2483
PseudoObjectExpr - An expression which accesses a pseudo-object l-value.
Definition Expr.h:6102
A (possibly-)qualified type.
Definition Type.h:731
The collection of all-type qualifiers we support.
Definition Type.h:147
Represents a struct/union/class.
Definition Decl.h:3919
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition Type.h:4706
Represents the body of a requires-expression.
Definition DeclCXX.h:1959
C++2a [expr.prim.req]: A requires-expression provides a concise way to express requirements on templa...
Scope - A scope is a transient data structure that is used while parsing the program.
Definition Scope.h:40
void incrementMSManglingNumber()
Definition Scope.h:328
Smart pointer class that efficiently represents Objective-C method names.
AlignPackInfo(AlignPackInfo::Mode M, unsigned Num, bool IsXL)
Definition Sema.h:494
bool operator==(const AlignPackInfo &Info) const
Definition Sema.h:554
static AlignPackInfo getFromRawEncoding(unsigned Encoding)
Definition Sema.h:526
unsigned getPackNumber() const
Definition Sema.h:544
bool IsXLStack() const
Definition Sema.h:552
bool IsPackSet() const
Definition Sema.h:546
AlignPackInfo(AlignPackInfo::Mode M, bool IsXL)
Definition Sema.h:500
bool IsAlignAttr() const
Definition Sema.h:540
bool IsPackAttr() const
Definition Sema.h:538
bool operator!=(const AlignPackInfo &Info) const
Definition Sema.h:560
AlignPackInfo(bool IsXL)
Definition Sema.h:504
static uint32_t getRawEncoding(const AlignPackInfo &Info)
Definition Sema.h:511
Mode getAlignMode() const
Definition Sema.h:542
RAII object used to change the argument pack substitution index within a Sema object.
Definition Sema.h:9173
ArgumentPackSubstitutionIndexRAII(Sema &Self, int NewSubstitutionIndex)
Definition Sema.h:9178
BoundTypeDiagnoser(unsigned DiagID, const Ts &...Args)
Definition Sema.h:2172
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2177
void emit(const SemaDiagnosticBuilder &DB, std::index_sequence< Is... >) const
Definition Sema.h:2164
std::tuple< const Ts &... > Args
Definition Sema.h:2161
RAII object used to temporarily allow the C++ 'this' expression to be used, with the given qualifiers...
Definition Sema.h:6486
CXXThisScopeRAII(Sema &S, Decl *ContextDecl, Qualifiers CXXThisTypeQuals, bool Enabled=true)
Introduce a new scope where 'this' may be allowed (when enabled), using the given declaration (which ...
A RAII object to enter scope of a compound statement.
Definition Sema.h:4905
CompoundScopeRAII(Sema &S, bool IsStmtExpr=false)
Definition Sema.h:4907
std::pair< VarDecl *, Expr * > get() const
Definition Sema.h:12437
llvm::Optional< bool > getKnownValue() const
Definition Sema.h:12441
A RAII object to temporarily push a declaration context.
Definition Sema.h:991
ContextRAII(Sema &S, DeclContext *ContextToPush, bool NewThisContext=true)
Definition Sema.h:1001
Abstract base class used to perform a contextual implicit conversion from an expression to any type p...
Definition Sema.h:3738
virtual SemaDiagnosticBuilder noteAmbiguous(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for one of the candidate conversions.
virtual SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
virtual SemaDiagnosticBuilder noteExplicitConv(Sema &S, CXXConversionDecl *Conv, QualType ConvTy)=0
Emits a note for the explicit conversion function.
virtual SemaDiagnosticBuilder diagnoseExplicitConv(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when the only matching conversion function is explicit.
virtual SemaDiagnosticBuilder diagnoseConversion(Sema &S, SourceLocation Loc, QualType T, QualType ConvTy)=0
Emits a diagnostic when we picked a conversion function (for cases when we are not allowed to pick a ...
virtual SemaDiagnosticBuilder diagnoseAmbiguous(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when there are multiple possible conversion functions.
ContextualImplicitConverter(bool Suppress=false, bool SuppressConversion=false)
Definition Sema.h:3743
virtual bool match(QualType T)=0
Determine whether the specified type is a valid destination type for this conversion.
virtual SemaDiagnosticBuilder diagnoseIncomplete(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic when the expression has incomplete class type.
For a defaulted function, the kind of defaulted function that it is.
Definition Sema.h:3305
DefaultedComparisonKind asComparison() const
Definition Sema.h:3328
DefaultedFunctionKind(CXXSpecialMember CSM)
Definition Sema.h:3313
CXXSpecialMember asSpecialMember() const
Definition Sema.h:3327
unsigned getDiagnosticIndex() const
Get the index of this function kind for use in diagnostics.
Definition Sema.h:3331
DefaultedFunctionKind(DefaultedComparisonKind Comp)
Definition Sema.h:3315
RAII class to control scope of DeferDiags.
Definition Sema.h:1854
DeferDiagsRAII(Sema &S, bool DeferDiags)
Definition Sema.h:1859
A class which encapsulates the logic for delaying diagnostics during parsing and other processing.
Definition Sema.h:939
DelayedDiagnosticsState push(sema::DelayedDiagnosticPool &pool)
Enter a new scope.
Definition Sema.h:960
void popUndelayed(DelayedDiagnosticsState state)
Undo a previous pushUndelayed().
Definition Sema.h:984
bool shouldDelayDiagnostics()
Determines whether diagnostics should be delayed.
Definition Sema.h:951
sema::DelayedDiagnosticPool * getCurrentPool() const
Returns the current delayed-diagnostics pool.
Definition Sema.h:954
void add(const sema::DelayedDiagnostic &diag)
Adds a delayed diagnostic.
void popWithoutEmitting(DelayedDiagnosticsState state)
Leave a delayed-diagnostic state that was previously pushed.
Definition Sema.h:970
DelayedDiagnosticsState pushUndelayed()
Enter a new scope where access and deprecation diagnostics are not delayed.
Definition Sema.h:976
A helper class for building up ExtParameterInfos.
Definition Sema.h:9598
const FunctionProtoType::ExtParameterInfo * getPointerOrNull(unsigned numParams)
Return a pointer (suitable for setting in an ExtProtoInfo) to the ExtParameterInfo array we've built ...
Definition Sema.h:9617
void set(unsigned index, FunctionProtoType::ExtParameterInfo info)
Set the ExtParameterInfo for the parameter at the given index,.
Definition Sema.h:9605
Records and restores the CurFPFeatures state on entry/exit of compound statements.
Definition Sema.h:1568
FPOptionsOverride getOverrides()
Definition Sema.h:1572
FullExprArg(Sema &actions)
Definition Sema.h:4856
ExprResult release()
Definition Sema.h:4858
Expr * get() const
Definition Sema.h:4862
GlobalEagerInstantiationScope(Sema &S, bool Enabled)
Definition Sema.h:9522
llvm::DenseMap< Selector, Lists >::iterator iterator
Definition Sema.h:1476
iterator find(Selector Sel)
Definition Sema.h:1479
std::pair< ObjCMethodList, ObjCMethodList > Lists
Definition Sema.h:1475
int count(Selector Sel) const
Definition Sema.h:1483
std::pair< iterator, bool > insert(std::pair< Selector, Lists > &&Val)
Definition Sema.h:1480
SemaDiagnosticBuilder diagnoseNoMatch(Sema &S, SourceLocation Loc, QualType T) override
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
Definition Sema.h:3799
virtual SemaDiagnosticBuilder diagnoseNotInt(Sema &S, SourceLocation Loc, QualType T)=0
Emits a diagnostic complaining that the expression does not have integral or enumeration type.
bool match(QualType T) override
Match an integral or (possibly scoped) enumeration type.
ICEConvertDiagnoser(bool AllowScopedEnumerations, bool Suppress, bool SuppressConversion)
Definition Sema.h:3790
Helper class that creates diagnostics with optional template instantiation stacks.
Definition Sema.h:1662
const ImmediateDiagBuilder & operator<<(T &&V) const
Definition Sema.h:1712
ImmediateDiagBuilder(DiagnosticBuilder &&DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1669
friend const ImmediateDiagBuilder & operator<<(const ImmediateDiagBuilder &Diag, const T &Value)
Teach operator<< to produce an object of the correct type.
Definition Sema.h:1701
ImmediateDiagBuilder(const ImmediateDiagBuilder &)=default
ImmediateDiagBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)
Definition Sema.h:1667
Helper class that collects exception specifications for implicitly-declared special member functions.
Definition Sema.h:6123
unsigned size() const
The number of exceptions in the exception specification.
Definition Sema.h:6156
ExceptionSpecificationType getExceptionSpecType() const
Get the computed exception specification type.
Definition Sema.h:6149
const QualType * data() const
The set of exceptions in the exception specification.
Definition Sema.h:6159
void CalledStmt(Stmt *S)
Integrate an invoked statement into the collected data.
void CalledExpr(Expr *E)
Integrate an invoked expression into the collected data.
Definition Sema.h:6165
void CalledDecl(SourceLocation CallLoc, const CXXMethodDecl *Method)
Integrate another called method into the collected data.
FunctionProtoType::ExceptionSpecInfo getExceptionSpec() const
Overwrite an EPI's exception specification with this computed exception specification.
Definition Sema.h:6172
static NameClassification DependentNonType()
Definition Sema.h:2639
static NameClassification VarTemplate(TemplateName Name)
Definition Sema.h:2649
ExprResult getExpression() const
Definition Sema.h:2675
NameClassification(const IdentifierInfo *Keyword)
Definition Sema.h:2613
static NameClassification Unknown()
Definition Sema.h:2619
static NameClassification OverloadSet(ExprResult E)
Definition Sema.h:2623
NameClassificationKind getKind() const
Definition Sema.h:2673
static NameClassification UndeclaredTemplate(TemplateName Name)
Definition Sema.h:2667
static NameClassification FunctionTemplate(TemplateName Name)
Definition Sema.h:2655
NamedDecl * getNonTypeDecl() const
Definition Sema.h:2685
NameClassification(ParsedType Type)
Definition Sema.h:2611
TemplateName getTemplateName() const
Definition Sema.h:2690
ParsedType getType() const
Definition Sema.h:2680
TemplateNameKind getTemplateNameKind() const
Definition Sema.h:2697
static NameClassification NonType(NamedDecl *D)
Definition Sema.h:2629
static NameClassification Concept(TemplateName Name)
Definition Sema.h:2661
static NameClassification UndeclaredNonType()
Definition Sema.h:2635
static NameClassification TypeTemplate(TemplateName Name)
Definition Sema.h:2643
static NameClassification Error()
Definition Sema.h:2615
Custom deleter to allow FunctionScopeInfos to be kept alive for a short time after they've been poppe...
Definition Sema.h:1934
void operator()(sema::FunctionScopeInfo *Scope) const
Definition Sema.cpp:2214
PragmaStackSentinelRAII(Sema &S, StringRef SlotLabel, bool ShouldAct)
Definition SemaAttr.cpp:27
Whether and why a template name is required in this lookup.
Definition Sema.h:7737
RequiredTemplateKind(TemplateNameIsRequiredTag)
Template name is unconditionally required.
Definition Sema.h:7743
SourceLocation getTemplateKeywordLoc() const
Definition Sema.h:7745
RequiredTemplateKind(SourceLocation TemplateKWLoc=SourceLocation())
Template name is required if TemplateKWLoc is valid.
Definition Sema.h:7740
RAII class used to determine whether SFINAE has trapped any errors that occur during template argumen...
Definition Sema.h:9423
bool hasErrorOccurred() const
Determine whether any SFINAE errors have been trapped.
Definition Sema.h:9454
SFINAETrap(Sema &SemaRef, bool AccessCheckingSFINAE=false)
Definition Sema.h:9431
A generic diagnostic builder for errors which may or may not be deferred.
Definition Sema.h:1733
void AddFixItHint(const FixItHint &Hint) const
Definition Sema.h:1803
friend const SemaDiagnosticBuilder & operator<<(const SemaDiagnosticBuilder &Diag, const T &Value)
Definition Sema.h:1772
SemaDiagnosticBuilder(Kind K, SourceLocation Loc, unsigned DiagID, FunctionDecl *Fn, Sema &S)
Definition Sema.cpp:1796
const SemaDiagnosticBuilder & operator<<(T &&V) const
Definition Sema.h:1786
friend StmtResult StmtError(const SemaDiagnosticBuilder &)
Definition Sema.h:1813
@ K_Nop
Emit no diagnostics.
Definition Sema.h:1737
@ K_Deferred
Create a deferred diagnostic, which is emitted only if the function it's attached to is codegen'ed.
Definition Sema.h:1747
@ K_ImmediateWithCallStack
Emit the diagnostic immediately, and, if it's a warning or error, also emit a call stack showing how ...
Definition Sema.h:1743
@ K_Immediate
Emit the diagnostic immediately (i.e., behave like Sema::Diag()).
Definition Sema.h:1739
friend ExprResult ExprError(const SemaDiagnosticBuilder &)
Definition Sema.h:1810
SemaDiagnosticBuilder(const SemaDiagnosticBuilder &)=default
A derivative of BoundTypeDiagnoser for which the diagnostic's type parameter is preceded by a 0/1 enu...
Definition Sema.h:2199
void diagnose(Sema &S, SourceLocation Loc, QualType T) override
Definition Sema.h:2204
SizelessTypeDiagnoser(unsigned DiagID, const Ts &... Args)
Definition Sema.h:2201
SpecialMemberOverloadResultEntry(const llvm::FoldingSetNodeID &ID)
Definition Sema.h:1412
SpecialMemberOverloadResult - The overloading result for a special member function.
Definition Sema.h:1385
SpecialMemberOverloadResult(CXXMethodDecl *MD)
Definition Sema.h:1398
CXXMethodDecl * getMethod() const
Definition Sema.h:1401
void setMethod(CXXMethodDecl *MD)
Definition Sema.h:1402
RAII object to handle the state changes required to synthesize a function body.
Definition Sema.h:1048
void addContextNote(SourceLocation UseLoc)
Definition Sema.h:1065
SynthesizedFunctionScope(Sema &S, DeclContext *DC)
Definition Sema.h:1054
RAII class used to indicate that we are performing provisional semantic analysis to determine the val...
Definition Sema.h:9463
TentativeAnalysisScope(Sema &SemaRef)
Definition Sema.h:9469
Abstract base class used for diagnosing integer constant expression violations.
Definition Sema.h:12516
virtual SemaDiagnosticBuilder diagnoseNotICE(Sema &S, SourceLocation Loc)=0
virtual SemaDiagnosticBuilder diagnoseNotICEType(Sema &S, SourceLocation Loc, QualType T)
VerifyICEDiagnoser(bool Suppress=false)
Definition Sema.h:12520
virtual SemaDiagnosticBuilder diagnoseFold(Sema &S, SourceLocation Loc)
Sema - This implements semantic analysis and AST building for C.
Definition Sema.h:355
AvailabilityAttr * mergeAvailabilityAttr(NamedDecl *D, const AttributeCommonInfo &CI, IdentifierInfo *Platform, bool Implicit, VersionTuple Introduced, VersionTuple Deprecated, VersionTuple Obsoleted, bool IsUnavailable, StringRef Message, bool IsStrict, StringRef Replacement, AvailabilityMergeKind AMK, int Priority)
Attribute merging methods. Return true if a new attribute was added.
FunctionDecl * FindUsualDeallocationFunction(SourceLocation StartLoc, bool CanProvideSize, bool Overaligned, DeclarationName Name)
const FieldDecl * getSelfAssignmentClassMemberCandidate(const ValueDecl *SelfAssigned)
Returns a field in a CXXRecordDecl that has the same name as the decl SelfAssigned when inside a CXXM...
void DeclareGlobalNewDelete()
DeclareGlobalNewDelete - Declare the global forms of operator new and delete.
StmtResult ActOnCXXForRangeIdentifier(Scope *S, SourceLocation IdentLoc, IdentifierInfo *Ident, ParsedAttributes &Attrs)
void DefineImplicitLambdaToFunctionPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a function pointer.
ExprResult CreateGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< TypeSourceInfo * > Types, ArrayRef< Expr * > Exprs)
ExprResult PerformImplicitConversion(Expr *From, QualType ToType, AssignmentAction Action, bool AllowExplicit=false)
PerformImplicitConversion - Perform an implicit conversion of the expression From to the type ToType.
void AddTemplateOverloadCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, OverloadCandidateParamOrder PO={})
Add a C++ function template specialization as a candidate in the candidate set, using template argume...
bool CheckInstantiatedFunctionTemplateConstraints(SourceLocation PointOfInstantiation, FunctionDecl *Decl, ArrayRef< TemplateArgument > TemplateArgs, ConstraintSatisfaction &Satisfaction)
QualType CheckSizelessVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
bool hasReachableDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a reachable definition.
QualType SubstAutoType(QualType TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
CXXConstructorDecl * DeclareImplicitDefaultConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit default constructor for the given class.
ObjCMethodDecl * LookupMethodInObjectType(Selector Sel, QualType Ty, bool IsInstance)
LookupMethodInType - Look up a method in an ObjCObjectType.
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old, Scope *S)
MergeCXXFunctionDecl - Merge two declarations of the same C++ function, once we already know that the...
Attr * getImplicitCodeSegOrSectionAttrForFunction(const FunctionDecl *FD, bool IsDefinition)
Returns an implicit CodeSegAttr if a __declspec(code_seg) is found on a containing class.
QualType BuildParenType(QualType T)
Build a paren type including T.
void CollectIvarsToConstructOrDestruct(ObjCInterfaceDecl *OI, SmallVectorImpl< ObjCIvarDecl * > &Ivars)
CollectIvarsToConstructOrDestruct - Collect those ivars which require initialization.
StmtResult ActOnOpenMPMetaDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp metadirective' after parsing of the associated statement.
MemInitResult BuildDelegatingInitializer(TypeSourceInfo *TInfo, Expr *Init, CXXRecordDecl *ClassDecl)
ParsedType CreateParsedType(QualType T, TypeSourceInfo *TInfo)
Package the given type and TSI into a ParsedType.
void CheckTypedefForVariablyModifiedType(Scope *S, TypedefNameDecl *D)
ExprResult ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXTypeid - Parse typeid( something ).
QualType getMessageSendResultType(const Expr *Receiver, QualType ReceiverType, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage)
Determine the result of a message send expression based on the type of the receiver,...
CXXSpecialMember getSpecialMember(const CXXMethodDecl *MD)
Definition Sema.h:3342
void ActOnObjCContainerStartDefinition(ObjCContainerDecl *IDecl)
OMPClause * ActOnOpenMPDependClause(const OMPDependClause::DependDataTy &Data, Expr *DepModifier, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depend' clause.
void ActOnPragmaMSOptimize(SourceLocation Loc, bool IsOn)
#pragma optimize("[optimization-list]", on | off).
QualType getCurrentThisType()
Try to retrieve the type of the 'this' pointer.
DeclResult ActOnClassTemplateSpecialization(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, SourceLocation ModulePrivateLoc, CXXScopeSpec &SS, TemplateIdAnnotation &TemplateId, const ParsedAttributesView &Attr, MultiTemplateParamsArg TemplateParameterLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnCXXUuidof(SourceLocation OpLoc, SourceLocation LParenLoc, bool isType, void *TyOrExpr, SourceLocation RParenLoc)
ActOnCXXUuidof - Parse __uuidof( something ).
bool CheckSpecifiedExceptionType(QualType &T, SourceRange Range)
CheckSpecifiedExceptionType - Check if the given type is valid in an exception specification.
ExprResult BuildOperatorCoawaitCall(SourceLocation Loc, Expr *E, UnresolvedLookupExpr *Lookup)
Build a call to 'operator co_await' if there is a suitable operator for the given expression.
bool ConstantFoldAttrArgs(const AttributeCommonInfo &CI, MutableArrayRef< Expr * > Args)
ConstantFoldAttrArgs - Folds attribute arguments into ConstantExprs (unless they are value dependent ...
Definition SemaAttr.cpp:387
ExprResult BuildBlockForLambdaConversion(SourceLocation CurrentLocation, SourceLocation ConvLocation, CXXConversionDecl *Conv, Expr *Src)
SmallVector< CodeSynthesisContext, 16 > CodeSynthesisContexts
List of active code synthesis contexts.
Definition Sema.h:9102
bool diagnoseArgDependentDiagnoseIfAttrs(const FunctionDecl *Function, const Expr *ThisArg, ArrayRef< const Expr * > Args, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any non-ArgDependent DiagnoseIf...
ExprResult PerformContextuallyConvertToObjCPointer(Expr *From)
PerformContextuallyConvertToObjCPointer - Perform a contextual conversion of the expression From to a...
bool buildOverloadedCallSet(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, MultiExprArg Args, SourceLocation RParenLoc, OverloadCandidateSet *CandidateSet, ExprResult *Result)
Constructs and populates an OverloadedCandidateSet from the given function.
llvm::SmallSetVector< CXXRecordDecl *, 16 > AssociatedClassSet
Definition Sema.h:3842
llvm::MapVector< Selector, SourceLocation > ReferencedSelectors
Method selectors used in a @selector expression.
Definition Sema.h:1500
LocalInstantiationScope * CurrentInstantiationScope
The current instantiation scope used to store local variables.
Definition Sema.h:9481
void CheckFloatComparison(SourceLocation Loc, Expr *LHS, Expr *RHS, BinaryOperatorKind Opcode)
Check for comparisons of floating-point values using == and !=.
Decl * ActOnAliasDeclaration(Scope *CurScope, AccessSpecifier AS, MultiTemplateParamsArg TemplateParams, SourceLocation UsingLoc, UnqualifiedId &Name, const ParsedAttributesView &AttrList, TypeResult Type, Decl *DeclFromDeclSpec)
Scope * getCurScope() const
Retrieve the parser's current scope.
Definition Sema.h:13365
void MergeTypedefNameDecl(Scope *S, TypedefNameDecl *New, LookupResult &OldDecls)
MergeTypedefNameDecl - We just parsed a typedef 'New' which has the same name and scope as a previous...
CUDAFunctionTarget IdentifyCUDATarget(const FunctionDecl *D, bool IgnoreImplicitHDAttr=false)
Determines whether the given function is a CUDA device/host/kernel/etc.
Definition SemaCUDA.cpp:116
bool hasStructuralCompatLayout(Decl *D, Decl *Suggested)
Determine if D and Suggested have a structurally compatible layout as described in C11 6....
void RegisterLocallyScopedExternCDecl(NamedDecl *ND, Scope *S)
Register the given locally-scoped extern "C" declaration so that it can be found later for redeclarat...
void GatherGlobalCodeCompletions(CodeCompletionAllocator &Allocator, CodeCompletionTUInfo &CCTUInfo, SmallVectorImpl< CodeCompletionResult > &Results)
const ValueDecl * getOpenMPDeclareMapperVarName() const
NamedDecl * getCurFunctionOrMethodDecl()
getCurFunctionOrMethodDecl - Return the Decl for the current ObjC method or C function we're in,...
Definition Sema.cpp:1452
BTFDeclTagAttr * mergeBTFDeclTagAttr(Decl *D, const BTFDeclTagAttr &AL)
bool isIncompatibleTypedef(TypeDecl *Old, TypedefNameDecl *New)
OMPClause * ActOnOpenMPUnifiedSharedMemoryClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
void ActOnModuleBegin(SourceLocation DirectiveLoc, Module *Mod)
The parsed has entered a submodule.
void CodeCompleteObjCProtocolDecl(Scope *S)
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveStart(Scope *S, DeclContext *DC, DeclarationName Name, ArrayRef< std::pair< QualType, SourceLocation > > ReductionTypes, AccessSpecifier AS, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare reduction'.
NamedDecl * ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope)
void PopParsingClass(ParsingClassState state)
Definition Sema.h:5209
bool CheckOverridingFunctionAttributes(const CXXMethodDecl *New, const CXXMethodDecl *Old)
DeclGroupPtrTy ActOnOpenMPDeclareSimdDirective(DeclGroupPtrTy DG, OMPDeclareSimdDeclAttr::BranchStateTy BS, Expr *Simdlen, ArrayRef< Expr * > Uniforms, ArrayRef< Expr * > Aligneds, ArrayRef< Expr * > Alignments, ArrayRef< Expr * > Linears, ArrayRef< unsigned > LinModifiers, ArrayRef< Expr * > Steps, SourceRange SR)
Called on well-formed '#pragma omp declare simd' after parsing of the associated method/function.
void CodeCompleteTag(Scope *S, unsigned TagSpec)
void adjustMemberFunctionCC(QualType &T, bool IsStatic, bool IsCtorOrDtor, SourceLocation Loc)
Adjust the calling convention of a method to be the ABI default if it wasn't specified explicitly.
bool RequireCompleteSizedExprType(Expr *E, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2481
void DiagnoseAbstractType(const CXXRecordDecl *RD)
void HideUsingShadowDecl(Scope *S, UsingShadowDecl *Shadow)
Hides a using shadow declaration.
bool CheckUsingDeclQualifier(SourceLocation UsingLoc, bool HasTypename, const CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, SourceLocation NameLoc, const LookupResult *R=nullptr, const UsingDecl *UD=nullptr)
Checks that the given nested-name qualifier used in a using decl in the current context is appropriat...
void CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, const ObjCMethodDecl *Overridden)
Check whether the given new method is a valid override of the given overridden method,...
bool IsBuildingRecoveryCallExpr
Flag indicating if Sema is building a recovery call expression.
Definition Sema.h:774
void LoadExternalWeakUndeclaredIdentifiers()
Load weak undeclared identifiers from the external source.
Definition Sema.cpp:914
bool containsUnexpandedParameterPacks(Declarator &D)
Determine whether the given declarator contains any unexpanded parameter packs.
bool isDeclInScope(NamedDecl *D, DeclContext *Ctx, Scope *S=nullptr, bool AllowInlineNamespace=false)
isDeclInScope - If 'Ctx' is a function/method, isDeclInScope returns true if 'D' is in Scope 'S',...
SemaDiagnosticBuilder diagIfOpenMPHostCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
QualType FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
FindCompositeObjCPointerType - Helper method to find composite type of two objective-c pointer types ...
llvm::SmallPtrSet< SpecialMemberDecl, 4 > SpecialMembersBeingDeclared
The C++ special members which we are currently in the process of declaring.
Definition Sema.h:1524
void ActOnParamUnparsedDefaultArgument(Decl *param, SourceLocation EqualLoc, SourceLocation ArgLoc)
ActOnParamUnparsedDefaultArgument - We've seen a default argument for a function parameter,...
void CheckObjCBridgeRelatedCast(QualType castType, Expr *castExpr)
OMPClause * ActOnOpenMPNumThreadsClause(Expr *NumThreads, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_threads' clause.
QualType CheckVectorConditionalTypes(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, SourceLocation QuestionLoc)
DefaultedFunctionKind getDefaultedFunctionKind(const FunctionDecl *FD)
Determine the kind of defaulting that would be done for a given function.
bool CheckARCMethodDecl(ObjCMethodDecl *method)
Check a method declaration for compatibility with the Objective-C ARC conventions.
ExprResult BuildMemberReferenceExpr(Expr *Base, QualType BaseType, SourceLocation OpLoc, bool IsArrow, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, ActOnMemberAccessExtraArgs *ExtraArgs=nullptr)
void ProcessStmtAttributes(Stmt *Stmt, const ParsedAttributes &InAttrs, SmallVectorImpl< const Attr * > &OutAttrs)
Process the attributes before creating an attributed statement.
ExprResult ActOnIntegerConstant(SourceLocation Loc, uint64_t Val)
void ActOnStartOfObjCMethodDef(Scope *S, Decl *D)
ActOnStartOfObjCMethodDef - This routine sets up parameters; invisible and user declared,...
llvm::DenseSet< Module * > & getLookupModules()
Get the set of additional modules that should be checked during name lookup.
void BuildBasePathArray(const CXXBasePaths &Paths, CXXCastPath &BasePath)
Decl * ActOnIvar(Scope *S, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, tok::ObjCKeywordKind visibility)
ActOnIvar - Each ivar field of an objective-c class is passed into this in order to create an IvarDec...
void DiagnoseUnusedParameters(ArrayRef< ParmVarDecl * > Parameters)
Diagnose any unused parameters in the given sequence of ParmVarDecl pointers.
DeclGroupPtrTy ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef< Decl * > Decls)
StmtResult BuildMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, NestedNameSpecifierLoc QualifierLoc, DeclarationNameInfo NameInfo, Stmt *Nested)
void ActOnPragmaAttributeEmptyPush(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Decl * ActOnParamDeclarator(Scope *S, Declarator &D)
ActOnParamDeclarator - Called from Parser::ParseFunctionDeclarator() to introduce parameters into fun...
ExprResult IgnoredValueConversions(Expr *E)
IgnoredValueConversions - Given that an expression's result is syntactically ignored,...
void MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old)
Merge the exception specifications of two variable declarations.
TemplateDeductionResult SubstituteExplicitTemplateArguments(FunctionTemplateDecl *FunctionTemplate, TemplateArgumentListInfo &ExplicitTemplateArgs, SmallVectorImpl< DeducedTemplateArgument > &Deduced, SmallVectorImpl< QualType > &ParamTypes, QualType *FunctionType, sema::TemplateDeductionInfo &Info)
Substitute the explicitly-provided template arguments into the given function template according to C...
OMPClause * ActOnOpenMPNovariantsClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'novariants' clause.
StmtResult ActOnOpenMPTargetTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target teams' after parsing of the associated statement.
NamedDecl * FindFirstQualifierInScope(Scope *S, NestedNameSpecifier *NNS)
If the given nested-name-specifier begins with a bare identifier (e.g., Base::), perform name lookup ...
bool tryExprAsCall(Expr &E, QualType &ZeroArgCallReturnTy, UnresolvedSetImpl &NonTemplateOverloads)
Figure out if an expression could be turned into a call.
Definition Sema.cpp:2391
LookupNameKind
Describes the kind of name lookup to perform.
Definition Sema.h:4161
@ LookupLabel
Label name lookup.
Definition Sema.h:4170
@ LookupOrdinaryName
Ordinary name lookup, which finds ordinary names (functions, variables, typedefs, etc....
Definition Sema.h:4165
@ LookupUsingDeclName
Look up all declarations in a scope with the given name, including resolved using declarations.
Definition Sema.h:4192
@ LookupNestedNameSpecifierName
Look up of a name that precedes the '::' scope resolution operator in C++.
Definition Sema.h:4184
@ LookupOMPReductionName
Look up the name of an OpenMP user-defined reduction operation.
Definition Sema.h:4206
@ LookupLocalFriendName
Look up a friend of a local class.
Definition Sema.h:4200
@ LookupObjCProtocolName
Look up the name of an Objective-C protocol.
Definition Sema.h:4202
@ LookupRedeclarationWithLinkage
Look up an ordinary name that is going to be redeclared as a name with linkage.
Definition Sema.h:4197
@ LookupOperatorName
Look up of an operator name (e.g., operator+) for use with operator overloading.
Definition Sema.h:4177
@ LookupObjCImplicitSelfParam
Look up implicit 'self' parameter of an objective-c method.
Definition Sema.h:4204
@ LookupNamespaceName
Look up a namespace name within a C++ using directive or namespace alias definition,...
Definition Sema.h:4188
@ LookupMemberName
Member name lookup, which finds the names of class/struct/union members.
Definition Sema.h:4173
@ LookupDestructorName
Look up a name following ~ in a destructor name.
Definition Sema.h:4180
@ LookupTagName
Tag name lookup, which finds the names of enums, classes, structs, and unions.
Definition Sema.h:4168
@ LookupOMPMapperName
Look up the name of an OpenMP user-defined mapper.
Definition Sema.h:4208
@ LookupAnyName
Look up any declaration with any name.
Definition Sema.h:4210
void CodeCompleteUsing(Scope *S)
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend)
Check that the expression co_await promise.final_suspend() shall not be potentially-throwing.
void DiagnoseFunctionSpecifiers(const DeclSpec &DS)
Diagnose function specifiers on a declaration of an identifier that does not identify a function.
QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc)
BuildAddressSpaceAttr - Builds a DependentAddressSpaceType if an expression is uninstantiated.
void ActOnPragmaAttributePop(SourceLocation PragmaLoc, const IdentifierInfo *Namespace)
Called on well-formed '#pragma clang attribute pop'.
ExprResult ParseObjCProtocolExpression(IdentifierInfo *ProtocolName, SourceLocation AtLoc, SourceLocation ProtoLoc, SourceLocation LParenLoc, SourceLocation ProtoIdLoc, SourceLocation RParenLoc)
ParseObjCProtocolExpression - Build protocol expression for @protocol.
void ActOnPopScope(SourceLocation Loc, Scope *S)
Scope actions.
QualType ReplaceAutoType(QualType TypeWithAuto, QualType Replacement)
Completely replace the auto in TypeWithAuto by Replacement.
ExprResult ActOnConstantExpression(ExprResult Res)
void ActOnPragmaDetectMismatch(SourceLocation Loc, StringRef Name, StringRef Value)
ActOnPragmaDetectMismatch - Call on well-formed #pragma detect_mismatch.
Definition SemaAttr.cpp:513
QualType CheckLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
EnforceTCBAttr * mergeEnforceTCBAttr(Decl *D, const EnforceTCBAttr &AL)
ExprResult ActOnNoexceptExpr(SourceLocation KeyLoc, SourceLocation LParen, Expr *Operand, SourceLocation RParen)
Decl * ActOnSkippedFunctionBody(Decl *Decl)
bool checkObjCBridgeRelatedComponents(SourceLocation Loc, QualType DestType, QualType SrcType, ObjCInterfaceDecl *&RelatedClass, ObjCMethodDecl *&ClassMethod, ObjCMethodDecl *&InstanceMethod, TypedefNameDecl *&TDNDecl, bool CfToNs, bool Diagnose=true)
bool RequireNonAbstractType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:7698
@ VariadicDoesNotApply
Definition Sema.h:11906
@ VariadicFunction
Definition Sema.h:11902
@ VariadicMethod
Definition Sema.h:11904
@ VariadicConstructor
Definition Sema.h:11905
@ VariadicBlock
Definition Sema.h:11903
void CodeCompleteObjCMethodDeclSelector(Scope *S, bool IsInstanceMethod, bool AtParameterName, ParsedType ReturnType, ArrayRef< IdentifierInfo * > SelIdents)
QualType deduceVarTypeFromInitializer(VarDecl *VDecl, DeclarationName Name, QualType Type, TypeSourceInfo *TSI, SourceRange Range, bool DirectInit, Expr *Init)
void EvaluateImplicitExceptionSpec(SourceLocation Loc, FunctionDecl *FD)
Evaluate the implicit exception specification for a defaulted special member function.
OMPClause * ActOnOpenMPWriteClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'write' clause.
TemplateName SubstTemplateName(NestedNameSpecifierLoc QualifierLoc, TemplateName Name, SourceLocation Loc, const MultiLevelTemplateArgumentList &TemplateArgs)
StmtResult ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, ArrayRef< Token > AsmToks, StringRef AsmString, unsigned NumOutputs, unsigned NumInputs, ArrayRef< StringRef > Constraints, ArrayRef< StringRef > Clobbers, ArrayRef< Expr * > Exprs, SourceLocation EndLoc)
OMPClause * ActOnOpenMPSingleExprWithArgClause(OpenMPClauseKind Kind, ArrayRef< unsigned > Arguments, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, ArrayRef< SourceLocation > ArgumentsLoc, SourceLocation DelimLoc, SourceLocation EndLoc)
void CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, Expr *OtherOpBase, SourceLocation OpLoc, bool IsArrow, bool IsBaseExprStatement, QualType PreferredType)
SmallVector< std::pair< const CXXMethodDecl *, const CXXMethodDecl * >, 2 > DelayedOverridingExceptionSpecChecks
All the overriding functions seen during a class definition that had their exception spec checks dela...
Definition Sema.h:898
ExplicitSpecifier ActOnExplicitBoolSpecifier(Expr *E)
ActOnExplicitBoolSpecifier - Build an ExplicitSpecifier from an expression found in an explicit(bool)...
ExprResult ActOnCompoundLiteral(SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc, Expr *InitExpr)
OMPClause * ActOnOpenMPExclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'exclusive' clause.
static int getOpenMPCaptureLevels(OpenMPDirectiveKind Kind)
Return the number of captured regions created for an OpenMP directive.
OMPClause * ActOnOpenMPUseDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_ptr' clause.
void ActOnFinishCXXNonNestedClass()
ParsedType getConstructorName(IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, bool EnteringContext)
bool CheckObjCBridgeRelatedConversions(SourceLocation Loc, QualType DestType, QualType SrcType, Expr *&SrcExpr, bool Diagnose=true)
bool SetMemberAccessSpecifier(NamedDecl *MemberDecl, NamedDecl *PrevMemberDecl, AccessSpecifier LexicalAS)
SetMemberAccessSpecifier - Set the access specifier of a member.
NamedDecl * FindInstantiatedDecl(SourceLocation Loc, NamedDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, bool FindingInstantiatedContext=false)
Find the instantiation of the given declaration within the current instantiation.
llvm::SmallSetVector< NamedDecl *, 16 > NamedDeclSetType
Definition Sema.h:836
bool BuildTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc, bool AllowUnexpandedPack)
NonTrivialCUnionContext
Definition Sema.h:2925
@ NTCUC_CopyInit
Definition Sema.h:2935
@ NTCUC_AutoVar
Definition Sema.h:2933
@ NTCUC_CompoundLiteral
Definition Sema.h:2939
@ NTCUC_DefaultInitializedObject
Definition Sema.h:2931
@ NTCUC_Assignment
Definition Sema.h:2937
@ NTCUC_BlockCapture
Definition Sema.h:2941
@ NTCUC_FunctionReturn
Definition Sema.h:2929
@ NTCUC_LValueToRValueVolatile
Definition Sema.h:2943
@ NTCUC_FunctionParam
Definition Sema.h:2927
MemInitResult BuildBaseInitializer(QualType BaseType, TypeSourceInfo *BaseTInfo, Expr *Init, CXXRecordDecl *ClassDecl, SourceLocation EllipsisLoc)
const Decl * PragmaAttributeCurrentTargetDecl
The declaration that is currently receiving an attribute from the #pragma attribute stack.
Definition Sema.h:753
ImplicitConversionSequence TryImplicitConversion(Expr *From, QualType ToType, bool SuppressUserConversions, AllowedExplicit AllowExplicit, bool InOverloadResolution, bool CStyle, bool AllowObjCWritebackConversion)
StmtResult BuildCoroutineBodyStmt(CoroutineBodyStmt::CtorArgs)
TemplateArgumentLoc SubstDefaultTemplateArgumentIfAvailable(TemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, Decl *Param, SmallVectorImpl< TemplateArgument > &Converted, bool &HasDefaultArg)
If the given template parameter has a default template argument, substitute into that default templat...
ExprResult BuildLiteralOperatorCall(LookupResult &R, DeclarationNameInfo &SuffixInfo, ArrayRef< Expr * > Args, SourceLocation LitEndLoc, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
BuildLiteralOperatorCall - Build a UserDefinedLiteral by creating a call to a literal operator descri...
bool MergeFunctionDecl(FunctionDecl *New, NamedDecl *&Old, Scope *S, bool MergeTypeWithOld, bool NewDeclIsDefn)
MergeFunctionDecl - We just parsed a function 'New' from declarator D which has the same name and sco...
ObjCCategoryDecl * ActOnStartCategoryInterface(SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *CategoryName, SourceLocation CategoryLoc, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
void CodeCompleteCase(Scope *S)
void RegisterTypeTagForDatatype(const IdentifierInfo *ArgumentKind, uint64_t MagicValue, QualType Type, bool LayoutCompatible, bool MustBeNull)
Register a magic integral constant to be used as a type tag.
bool hasReachableDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
MissingImportKind
Kinds of missing import.
Definition Sema.h:3151
StmtResult ActOnOpenMPScanDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp scan'.
llvm::SmallVector< DeleteExprLoc, 4 > DeleteLocs
Definition Sema.h:851
bool isValidPointerAttrType(QualType T, bool RefOkay=false)
Determine if type T is a valid subject for a nonnull and similar attributes.
llvm::DenseSet< Module * > LookupModulesCache
Cache of additional modules that should be used for name lookup within the current template instantia...
Definition Sema.h:9118
ExprResult BuildCoyieldExpr(SourceLocation KwLoc, Expr *E)
void ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class)
Force the declaration of any implicitly-declared members of this class.
bool isTemplateTemplateParameterAtLeastAsSpecializedAs(TemplateParameterList *PParam, TemplateDecl *AArg, SourceLocation Loc)
ExprResult ActOnRequiresExpr(SourceLocation RequiresKWLoc, RequiresExprBodyDecl *Body, ArrayRef< ParmVarDecl * > LocalParameters, ArrayRef< concepts::Requirement * > Requirements, SourceLocation ClosingBraceLoc)
OMPClause * ActOnOpenMPGrainsizeClause(Expr *Size, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'grainsize' clause.
bool areVectorTypesSameSize(QualType srcType, QualType destType)
ExprResult ActOnObjCAtSynchronizedOperand(SourceLocation atLoc, Expr *operand)
bool isConstantEvaluated()
Definition Sema.h:1041
bool hasVisibleDeclarationSlow(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules)
TemplateParameterList * ActOnTemplateParameterList(unsigned Depth, SourceLocation ExportLoc, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl * > Params, SourceLocation RAngleLoc, Expr *RequiresClause)
ActOnTemplateParameterList - Builds a TemplateParameterList, optionally constrained by RequiresClause...
void LookupNecessaryTypesForBuiltin(Scope *S, unsigned ID)
bool isSelfExpr(Expr *RExpr)
Private Helper predicate to check for 'self'.
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition Sema.cpp:1860
ExprResult BuildIvarRefExpr(Scope *S, SourceLocation Loc, ObjCIvarDecl *IV)
RetainOwnershipKind
Definition Sema.h:10539
bool CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, TemplateArgumentLoc &Arg, SmallVectorImpl< TemplateArgument > &Converted)
void CodeCompleteObjCMessageReceiver(Scope *S)
void ActOnTagDefinitionError(Scope *S, Decl *TagDecl)
ActOnTagDefinitionError - Invoked when there was an unrecoverable error parsing the definition of a t...
void DiagnoseAlwaysNonNullPointer(Expr *E, Expr::NullPointerConstantKind NullType, bool IsEqual, SourceRange Range)
Diagnose pointers that are always non-null.
ExprResult BuildCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
BuildCXXDefaultArgExpr - Creates a CXXDefaultArgExpr, instantiating the default expr if needed.
bool IsStringInit(Expr *Init, const ArrayType *AT)
Definition SemaInit.cpp:145
ObjCMethodDecl * ArrayWithObjectsMethod
The declaration of the arrayWithObjects:count: method.
Definition Sema.h:1197
DeclGroupPtrTy ActOnForwardClassDeclaration(SourceLocation Loc, IdentifierInfo **IdentList, SourceLocation *IdentLocs, ArrayRef< ObjCTypeParamList * > TypeParamLists, unsigned NumElts)
void DefineImplicitMoveAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared move assignment operator.
void ActOnFinishDelayedMemberInitializers(Decl *Record)
ObjCMethodDecl * StringWithUTF8StringMethod
The declaration of the stringWithUTF8String: method.
Definition Sema.h:1188
void CheckCompletedCoroutineBody(FunctionDecl *FD, Stmt *&Body)
bool LookupInSuper(LookupResult &R, CXXRecordDecl *Class)
Perform qualified name lookup into all base classes of the given class.
std::function< void(const TypoCorrection &)> TypoDiagnosticGenerator
Definition Sema.h:4269
void addImplicitTypedef(StringRef Name, QualType T)
Definition Sema.cpp:260
void PrintContextStack()
Definition Sema.h:9383
void DecomposeUnqualifiedId(const UnqualifiedId &Id, TemplateArgumentListInfo &Buffer, DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *&TemplateArgs)
Decomposes the given name into a DeclarationNameInfo, its location, and possibly a list of template a...
void CheckConflictingOverridingMethod(ObjCMethodDecl *Method, ObjCMethodDecl *Overridden, bool IsProtocolMethodDecl)
bool ActOnCoroutineBodyStart(Scope *S, SourceLocation KwLoc, StringRef Keyword)
QualType BuildVectorType(QualType T, Expr *VecSize, SourceLocation AttrLoc)
bool InstantiateDefaultArgument(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
void ActOnOpenMPLoopInitialization(SourceLocation ForLoc, Stmt *Init)
Check if the current region is an OpenMP loop region and if it is, mark loop control variable,...
std::pair< StringRef, QualType > CapturedParamNameType
Definition Sema.h:5030
StmtResult BuildAttributedStmt(SourceLocation AttrsLoc, ArrayRef< const Attr * > Attrs, Stmt *SubStmt)
Definition SemaStmt.cpp:582
OMPClause * ActOnOpenMPToClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'to' clause.
NamespaceDecl * CoroTraitsNamespaceCache
The namespace where coroutine components are defined.
Definition Sema.h:1151
ObjCImplementationDecl * ActOnStartClassImplementation(SourceLocation AtClassImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperClassname, SourceLocation SuperClassLoc, const ParsedAttributesView &AttrList)
void ActOnOpenMPEndAssumesDirective()
Called on well-formed '#pragma omp end assumes'.
IfExistsResult
Describes the result of an "if-exists" condition check.
Definition Sema.h:5858
@ IER_DoesNotExist
The symbol does not exist.
Definition Sema.h:5863
@ IER_Dependent
The name is a dependent name, so the results will differ from one instantiation to the next.
Definition Sema.h:5867
@ IER_Error
An error occurred.
Definition Sema.h:5870
@ IER_Exists
The symbol exists.
Definition Sema.h:5860
void CheckDelegatingCtorCycles()
void ActOnStartStmtExpr()
ExprResult BuildLambdaExpr(SourceLocation StartLoc, SourceLocation EndLoc, sema::LambdaScopeInfo *LSI)
Complete a lambda-expression having processed and attached the lambda body.
NamedDecl * ActOnTemplateTemplateParameter(Scope *S, SourceLocation TmpLoc, TemplateParameterList *Params, SourceLocation EllipsisLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedTemplateArgument DefaultArg)
ActOnTemplateTemplateParameter - Called when a C++ template template parameter (e....
bool ActOnTypeConstraint(const CXXScopeSpec &SS, TemplateIdAnnotation *TypeConstraint, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
ExprResult BuildCXXNew(SourceRange Range, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, QualType AllocType, TypeSourceInfo *AllocTypeInfo, Optional< Expr * > ArraySize, SourceRange DirectInitRange, Expr *Initializer)
ExprResult CreateOverloadedArraySubscriptExpr(SourceLocation LLoc, SourceLocation RLoc, Expr *Base, MultiExprArg Args)
CUDAFunctionPreference
Definition Sema.h:12707
@ CFP_HostDevice
Definition Sema.h:12712
@ CFP_SameSide
Definition Sema.h:12713
@ CFP_WrongSide
Definition Sema.h:12709
OMPClause * ActOnOpenMPFlushClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'flush' pseudo clause.
bool hasVisibleDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is visible.
Definition Sema.h:2336
bool FormatStringHasSArg(const StringLiteral *FExpr)
void WarnOnPendingNoDerefs(ExpressionEvaluationContextRecord &Rec)
Emit a warning for all pending noderef expressions that we recorded.
QualType ProduceCallSignatureHelp(Expr *Fn, ArrayRef< Expr * > Args, SourceLocation OpenParLoc)
Determines the preferred type of the current function argument, by examining the signatures of all po...
TypeVisibilityAttr * mergeTypeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, TypeVisibilityAttr::VisibilityType Vis)
void ActOnStmtExprError()
bool IsLastErrorImmediate
Is the last error level diagnostic immediate.
Definition Sema.h:1837
void DiagnoseUnterminatedOpenMPDeclareTarget()
Report unterminated 'omp declare target' or 'omp begin declare target' at the end of a compilation un...
StmtResult ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope)
DeclResult LookupIvarInObjCMethod(LookupResult &Lookup, Scope *S, IdentifierInfo *II)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
void CodeCompleteInitializer(Scope *S, Decl *D)
void ActOnPragmaFEnvRound(SourceLocation Loc, llvm::RoundingMode)
Called to set constant rounding mode for floating point operations.
void AddAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, bool IsPackExpansion)
AddAlignedAttr - Adds an aligned attribute to a particular declaration.
ObjCInterfaceDecl * NSDictionaryDecl
The declaration of the Objective-C NSDictionary class.
Definition Sema.h:1200
bool DiagnoseClassNameShadow(DeclContext *DC, DeclarationNameInfo Info)
DiagnoseClassNameShadow - Implement C++ [class.mem]p13: If T is the name of a class,...
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc, Stmt *First, Expr *collection, SourceLocation RParenLoc)
AccessResult CheckFriendAccess(NamedDecl *D)
Checks access to the target of a friend declaration.
QualType UsualArithmeticConversions(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, ArithConvKind ACK)
UsualArithmeticConversions - Performs various conversions that are common to binary operators (C99 6....
bool CheckMessageArgumentTypes(const Expr *Receiver, QualType ReceiverType, MultiExprArg Args, Selector Sel, ArrayRef< SourceLocation > SelectorLocs, ObjCMethodDecl *Method, bool isClassMessage, bool isSuperMessage, SourceLocation lbrac, SourceLocation rbrac, SourceRange RecRange, QualType &ReturnType, ExprValueKind &VK)
CheckMessageArgumentTypes - Check types in an Obj-C message send.
static const IdentifierInfo * getPrintable(const IdentifierInfo *II)
Definition Sema.h:2148
OMPClause * ActOnOpenMPDeviceClause(OpenMPDeviceClauseModifier Modifier, Expr *Device, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation EndLoc)
Called on well-formed 'device' clause.
QualType ProduceConstructorSignatureHelp(QualType Type, SourceLocation Loc, ArrayRef< Expr * > Args, SourceLocation OpenParLoc, bool Braced)
StmtResult ActOnForEachLValueExpr(Expr *E)
In an Objective C collection iteration statement: for (x in y) x can be an arbitrary l-value expressi...
void MarkBaseAndMemberDestructorsReferenced(SourceLocation Loc, CXXRecordDecl *Record)
MarkBaseAndMemberDestructorsReferenced - Given a record decl, mark all the non-trivial destructors of...
const TranslationUnitKind TUKind
The kind of translation unit we are processing.
Definition Sema.h:1432
OMPClause * ActOnOpenMPUseDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'use_device_addr' clause.
llvm::SmallPtrSet< const CXXRecordDecl *, 8 > RecordDeclSetTy
Definition Sema.h:854
OMPClause * ActOnOpenMPPriorityClause(Expr *Priority, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'priority' clause.
void ActOnTagFinishDefinition(Scope *S, Decl *TagDecl, SourceRange BraceRange)
ActOnTagFinishDefinition - Invoked once we have finished parsing the definition of a tag (enumeration...
FunctionEmissionStatus
Status of the function emission on the CUDA/HIP/OpenMP host/device attrs.
Definition Sema.h:4375
llvm::SmallSetVector< const TypedefNameDecl *, 4 > UnusedLocalTypedefNameCandidates
Set containing all typedefs that are likely unused.
Definition Sema.h:843
PragmaClangSection PragmaClangRodataSection
Definition Sema.h:472
DeclResult ActOnCXXConditionDeclaration(Scope *S, Declarator &D)
ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a C++ if/switch/while/for statem...
void CheckPtrComparisonWithNullChar(ExprResult &E, ExprResult &NullE)
void LookupOverloadedBinOp(OverloadCandidateSet &CandidateSet, OverloadedOperatorKind Op, const UnresolvedSetImpl &Fns, ArrayRef< Expr * > Args, bool RequiresADL=true)
Perform lookup for an overloaded binary operator.
void NoteAllFoundTemplates(TemplateName Name)
CXXRecordDecl * createLambdaClosureType(SourceRange IntroducerRange, TypeSourceInfo *Info, unsigned LambdaDependencyKind, LambdaCaptureDefault CaptureDefault)
Create a new lambda closure type.
bool hasVisibleDefinition(const NamedDecl *D)
Definition Sema.h:2363
ObjCContainerKind
Definition Sema.h:9842
@ OCK_Interface
Definition Sema.h:9844
@ OCK_ClassExtension
Definition Sema.h:9847
@ OCK_Category
Definition Sema.h:9846
@ OCK_Implementation
Definition Sema.h:9848
@ OCK_CategoryImplementation
Definition Sema.h:9849
@ OCK_Protocol
Definition Sema.h:9845
DelegatingCtorDeclsType DelegatingCtorDecls
All the delegating constructors seen so far in the file, used for cycle detection at the end of the T...
Definition Sema.h:892
concepts::Requirement * ActOnTypeRequirement(SourceLocation TypenameKWLoc, CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo *TypeName, TemplateIdAnnotation *TemplateId)
void emitAndClearUnusedLocalTypedefWarnings()
Definition Sema.cpp:1005
bool ActOnAccessSpecifier(AccessSpecifier Access, SourceLocation ASLoc, SourceLocation ColonLoc, const ParsedAttributesView &Attrs)
ActOnAccessSpecifier - Parsed an access specifier followed by a colon.
NamedDecl * ImplicitlyDefineFunction(SourceLocation Loc, IdentifierInfo &II, Scope *S)
ImplicitlyDefineFunction - An undeclared identifier was used in a function call, forming a call to an...
bool DiagnoseUninstantiableTemplate(SourceLocation PointOfInstantiation, NamedDecl *Instantiation, bool InstantiatedFromMember, const NamedDecl *Pattern, const NamedDecl *PatternDef, TemplateSpecializationKind TSK, bool Complain=true)
Determine whether we would be unable to instantiate this template (because it either has no definitio...
std::unique_ptr< CXXFieldCollector > FieldCollector
FieldCollector - Collects CXXFieldDecls during parsing of C++ classes.
Definition Sema.h:834
StmtResult ActOnOpenMPOrderedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp ordered' after parsing of the associated statement.
static bool getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, bool IsVariadic, FormatStringInfo *FSI)
Given a FunctionDecl's FormatAttr, attempts to populate the FomatStringInfo parameter with the Format...
void ActOnForEachDeclStmt(DeclGroupPtrTy Decl)
Definition SemaStmt.cpp:83
void InstantiateExceptionSpec(SourceLocation PointOfInstantiation, FunctionDecl *Function)
std::unique_ptr< NSAPI > NSAPIObj
Caches identifiers/selectors for NSFoundation APIs.
Definition Sema.h:1164
void AddAssumeAlignedAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E, Expr *OE)
AddAssumeAlignedAttr - Adds an assume_aligned attribute to a particular declaration.
bool checkSectionName(SourceLocation LiteralLoc, StringRef Str)
VarDecl * buildCoroutinePromise(SourceLocation Loc)
void AddPragmaAttributes(Scope *S, Decl *D)
Adds the attributes that have been specified using the '#pragma clang attribute push' directives to t...
OMPClause * ActOnOpenMPLinearClause(ArrayRef< Expr * > VarList, Expr *Step, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind LinKind, SourceLocation LinLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'linear' clause.
ExprResult ActOnExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
ActOnExpressionTrait - Parsed one of the unary type trait support pseudo-functions.
TemplateDecl * AdjustDeclIfTemplate(Decl *&Decl)
AdjustDeclIfTemplate - If the given decl happens to be a template, reset the parameter D to reference...
void addLambdaParameters(ArrayRef< LambdaIntroducer::LambdaCapture > Captures, CXXMethodDecl *CallOperator, Scope *CurScope)
Introduce the lambda parameters into scope.
bool isImplicitlyDeleted(FunctionDecl *FD)
Determine whether the given function is an implicitly-deleted special member function.
void CheckImplicitSpecialMemberDeclaration(Scope *S, FunctionDecl *FD)
Check a completed declaration of an implicit special member.
void PushExpressionEvaluationContext(ExpressionEvaluationContext NewContext, Decl *LambdaContextDecl=nullptr, ExpressionEvaluationContextRecord::ExpressionKind Type=ExpressionEvaluationContextRecord::EK_Other)
StmtResult ActOnOpenMPCancellationPointDirective(SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancellation point'.
TemplateArgumentLoc getTemplateArgumentPackExpansionPattern(TemplateArgumentLoc OrigLoc, SourceLocation &Ellipsis, Optional< unsigned > &NumExpansions) const
Returns the pattern of the pack expansion for a template argument.
ObjCMethodDecl * LookupInstanceMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupInstanceMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:4825
bool checkCommonAttributeFeatures(const Decl *D, const ParsedAttr &A, bool SkipArgCountCheck=false)
Handles semantic checking for features that are common to all attributes, such as checking whether a ...
PragmaClangSectionAction
Definition Sema.h:459
@ PCSA_Set
Definition Sema.h:460
@ PCSA_Clear
Definition Sema.h:461
void CodeCompleteObjCAtDirective(Scope *S)
bool CompleteConstructorCall(CXXConstructorDecl *Constructor, QualType DeclInitType, MultiExprArg ArgsPtr, SourceLocation Loc, SmallVectorImpl< Expr * > &ConvertedArgs, bool AllowExplicit=false, bool IsListInitialization=false)
Given a constructor and the set of arguments provided for the constructor, convert the arguments and ...
bool IsAtLeastAsConstrained(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2, bool &Result)
Check whether the given declaration's associated constraints are at least as constrained than another...
ExprResult CheckBooleanCondition(SourceLocation Loc, Expr *E, bool IsConstexpr=false)
CheckBooleanCondition - Diagnose problems involving the use of the given expression as a boolean cond...
OMPClause * ActOnOpenMPNowaitClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nowait' clause.
void InstantiateClassTemplateSpecializationMembers(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK)
Instantiate the definitions of all of the members of the given class template specialization,...
IdentifierInfo * getFloat128Identifier() const
Definition Sema.cpp:2622
bool isOpenMPDeclareMapperVarDeclAllowed(const VarDecl *VD) const
void Initialize()
Perform initialization that occurs after the parser has been initialized but before it parses anythin...
Definition Sema.cpp:266
@ Boolean
A boolean condition, from 'if', 'while', 'for', or 'do'.
@ Switch
An integral condition for a 'switch' statement.
@ ConstexprIf
A constant boolean condition from 'if constexpr'.
void AddOptnoneAttributeIfNoConflicts(FunctionDecl *FD, SourceLocation Loc)
Adds the 'optnone' attribute to the function declaration if there are no conflicts; Loc represents th...
ExprResult ActOnObjCBridgedCast(Scope *S, SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, ParsedType Type, SourceLocation RParenLoc, Expr *SubExpr)
void addAMDGPUWavesPerEUAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUWavePersEUAttr - Adds an amdgpu_waves_per_eu attribute to a particular declaration.
bool RequireCompleteType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Definition Sema.h:2437
OMPClause * ActOnOpenMPClause(OpenMPClauseKind Kind, SourceLocation StartLoc, SourceLocation EndLoc)
bool RequireCompleteDeclContext(CXXScopeSpec &SS, DeclContext *DC)
Require that the context specified by SS be complete.
static SourceRange getPrintable(SourceLocation L)
Definition Sema.h:2154
llvm::SmallPtrSet< const Decl *, 4 > ParsingInitForAutoVars
ParsingInitForAutoVars - a set of declarations with auto types for which we are currently parsing the...
Definition Sema.h:863
void AddConversionCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
AddConversionCandidate - Add a C++ conversion function as a candidate in the candidate set (C++ [over...
ExprResult ActOnIdExpression(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool HasTrailingLParen, bool IsAddressOfOperand, CorrectionCandidateCallback *CCC=nullptr, bool IsInlineAsmIdentifier=false, Token *KeywordReplacement=nullptr)
ObjCTypeParamList * actOnObjCTypeParamList(Scope *S, SourceLocation lAngleLoc, ArrayRef< Decl * > typeParams, SourceLocation rAngleLoc)
Decl * ActOnNamespaceAliasDef(Scope *CurScope, SourceLocation NamespaceLoc, SourceLocation AliasLoc, IdentifierInfo *Alias, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
void CUDACheckLambdaCapture(CXXMethodDecl *D, const sema::Capture &Capture)
Definition SemaCUDA.cpp:852
void CheckOverrideControl(NamedDecl *D)
CheckOverrideControl - Check C++11 override control semantics.
@ PartitionImplementation
'module X:Y;'
@ Interface
'export module X;'
@ PartitionInterface
'export module X:Y;'
WebAssemblyImportNameAttr * mergeImportNameAttr(Decl *D, const WebAssemblyImportNameAttr &AL)
void CheckCategoryVsClassMethodMatches(ObjCCategoryImplDecl *CatIMP)
CheckCategoryVsClassMethodMatches - Checks that methods implemented in category matches with those im...
SmallVector< sema::FunctionScopeInfo *, 4 > FunctionScopes
Stack containing information about each of the nested function, block, and method scopes that are cur...
Definition Sema.h:796
void ActOnExitFunctionContext()
bool CheckObjCARCUnavailableWeakConversion(QualType castType, QualType ExprType)
void ActOnTypedefedProtocols(SmallVectorImpl< Decl * > &ProtocolRefs, SmallVectorImpl< SourceLocation > &ProtocolLocs, IdentifierInfo *SuperName, SourceLocation SuperLoc)
ActOnTypedefedProtocols - this action finds protocol list as part of the typedef'ed use for a qualifi...
ReferenceCompareResult
ReferenceCompareResult - Expresses the result of comparing two types (cv1 T1 and cv2 T2) to determine...
Definition Sema.h:12277
@ Ref_Incompatible
Ref_Incompatible - The two types are incompatible, so direct reference binding is not possible.
Definition Sema.h:12280
@ Ref_Compatible
Ref_Compatible - The two types are reference-compatible.
Definition Sema.h:12286
@ Ref_Related
Ref_Related - The two types are reference-related, which means that their unqualified forms (T1 and T...
Definition Sema.h:12284
StmtResult ActOnOpenMPDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for' after parsing of the associated statement...
bool CheckDependentFunctionTemplateSpecialization(FunctionDecl *FD, const TemplateArgumentListInfo &ExplicitTemplateArgs, LookupResult &Previous)
Perform semantic analysis for the given dependent function template specialization.
void RefersToMemberWithReducedAlignment(Expr *E, llvm::function_ref< void(Expr *, RecordDecl *, FieldDecl *, CharUnits)> Action)
This function calls Action when it determines that E designates a misaligned member due to the packed...
void ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro, Declarator &ParamInfo, Scope *CurScope)
ActOnStartOfLambdaDefinition - This is called just before we start parsing the body of a lambda; it a...
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType)
Definition Sema.h:7665
DeduceAutoResult DeduceAutoType(TypeSourceInfo *AutoType, Expr *&Initializer, QualType &Result, Optional< unsigned > DependentDeductionDepth=None, bool IgnoreConstraints=false)
ExprResult RebuildExprInCurrentInstantiation(Expr *E)
@ AR_dependent
Definition Sema.h:7601
@ AR_accessible
Definition Sema.h:7599
@ AR_inaccessible
Definition Sema.h:7600
@ AR_delayed
Definition Sema.h:7602
PoppedFunctionScopePtr PopFunctionScopeInfo(const sema::AnalysisBasedWarnings::Policy *WP=nullptr, const Decl *D=nullptr, QualType BlockType=QualType())
Pop a function (or block or lambda or captured region) scope from the stack.
Definition Sema.cpp:2191
ClassTemplatePartialSpecializationDecl * getMoreSpecializedPartialSpecialization(ClassTemplatePartialSpecializationDecl *PS1, ClassTemplatePartialSpecializationDecl *PS2, SourceLocation Loc)
Returns the more specialized class template partial specialization according to the rules of partial ...
CompleteTypeKind
Definition Sema.h:2211
@ Normal
Apply the normal rules for complete types.
@ AcceptSizeless
Relax the normal rules for complete types so that they include sizeless built-in types.
bool checkAndRewriteMustTailAttr(Stmt *St, const Attr &MTA)
Check whether the given statement can have musttail applied to it, issuing a diagnostic and returning...
Definition SemaStmt.cpp:611
ExprResult BuildCXXFunctionalCastExpr(TypeSourceInfo *TInfo, QualType Type, SourceLocation LParenLoc, Expr *CastExpr, SourceLocation RParenLoc)
void AddTemplateConversionCandidate(FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, Expr *From, QualType ToType, OverloadCandidateSet &CandidateSet, bool AllowObjCConversionOnExplicit, bool AllowExplicit, bool AllowResultConversion=true)
Adds a conversion function template specialization candidate to the overload set, using template argu...
Preprocessor & getPreprocessor() const
Definition Sema.h:1624
OMPClause * ActOnOpenMPDynamicAllocatorsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'dynamic_allocators' clause.
Scope * getScopeForContext(DeclContext *Ctx)
Determines the active Scope associated with the given declaration context.
Definition Sema.cpp:2055
QualType GetSignedSizelessVectorType(QualType V)
llvm::DenseSet< std::pair< Decl *, unsigned > > InstantiatingSpecializations
Specializations whose definitions are currently being instantiated.
Definition Sema.h:9105
bool CheckCXXThisCapture(SourceLocation Loc, bool Explicit=false, bool BuildAndDiagnose=true, const unsigned *const FunctionScopeIndexToStopAt=nullptr, bool ByCopy=false)
Make sure the value of 'this' is actually available in the current context, if it is a potentially ev...
ExprResult BuildBuiltinBitCastExpr(SourceLocation KWLoc, TypeSourceInfo *TSI, Expr *Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:394
CXXConstructorDecl * DeclareImplicitMoveConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit move constructor for the given class.
void CodeCompletePreprocessorMacroArgument(Scope *S, IdentifierInfo *Macro, MacroInfo *MacroInfo, unsigned Argument)
class clang::Sema::DelayedDiagnostics DelayedDiagnostics
bool ProcessAccessDeclAttributeList(AccessSpecDecl *ASDecl, const ParsedAttributesView &AttrList)
void AddBuiltinCandidate(QualType *ParamTys, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool IsAssignmentOperator=false, unsigned NumContextualBoolArguments=0)
AddBuiltinCandidate - Add a candidate for a built-in operator.
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, FunctionDeclAndLoc > DeviceKnownEmittedFns
An inverse call graph, mapping known-emitted functions to one of their known-emitted callers (plus th...
Definition Sema.h:12598
void deduceOpenCLAddressSpace(ValueDecl *decl)
ExprResult ActOnCharacterConstant(const Token &Tok, Scope *UDLScope=nullptr)
ParsedType getInheritingConstructorName(CXXScopeSpec &SS, SourceLocation NameLoc, IdentifierInfo &Name)
Handle the result of the special case name lookup for inheriting constructor declarations.
StmtResult ActOnGotoStmt(SourceLocation GotoLoc, SourceLocation LabelLoc, LabelDecl *TheDecl)
PragmaStack< FPOptionsOverride > FpPragmaStack
Definition Sema.h:695
ExprResult BuildObjCDictionaryLiteral(SourceRange SR, MutableArrayRef< ObjCDictionaryElement > Elements)
DefaultedComparisonKind getDefaultedComparisonKind(const FunctionDecl *FD)
Definition Sema.h:3345
bool SubstTypeConstraint(TemplateTypeParmDecl *Inst, const TypeConstraint *TC, const MultiLevelTemplateArgumentList &TemplateArgs)
void EraseUnwantedCUDAMatches(const FunctionDecl *Caller, SmallVectorImpl< std::pair< DeclAccessPair, FunctionDecl * > > &Matches)
Finds a function in Matches with highest calling priority from Caller context and erases all function...
Definition SemaCUDA.cpp:272
static SourceRange getPrintable(const Expr *E)
Definition Sema.h:2155
PragmaStack< StringLiteral * > CodeSegStack
Definition Sema.h:692
OMPClause * ActOnOpenMPAllocateClause(Expr *Allocator, ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation ColonLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocate' clause.
ExprResult MaybeBindToTemporary(Expr *E)
MaybeBindToTemporary - If the passed in expression has a record type with a non-trivial destructor,...
StmtResult ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, Scope *CurScope)
void AddRangeBasedOptnone(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based o...
void referenceDLLExportedClassMethods()
VarTemplateSpecializationDecl * BuildVarTemplateInstantiation(VarTemplateDecl *VarTemplate, VarDecl *FromVar, const TemplateArgumentList &TemplateArgList, const TemplateArgumentListInfo &TemplateArgsInfo, SmallVectorImpl< TemplateArgument > &Converted, SourceLocation PointOfInstantiation, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *StartingScope=nullptr)
StmtResult BuildCoreturnStmt(SourceLocation KwLoc, Expr *E, bool IsImplicit=false)
llvm::DenseMap< IdentifierInfo *, SrcLocSet > IdentifierSourceLocations
Definition Sema.h:9491
void CheckCompleteDestructorVariant(SourceLocation CurrentLocation, CXXDestructorDecl *Dtor)
Do semantic checks to allow the complete destructor variant to be emitted when the destructor is defi...
NamedDecl * ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, Expr *BitfieldWidth, const VirtSpecifiers &VS, InClassInitStyle InitStyle)
ActOnCXXMemberDeclarator - This is invoked when a C++ class member declarator is parsed.
bool CheckIfOverriddenFunctionIsMarkedFinal(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckForFunctionMarkedFinal - Checks whether a virtual member function overrides a virtual member fun...
DLLImportAttr * mergeDLLImportAttr(Decl *D, const AttributeCommonInfo &CI)
static NamedDecl * getAsTemplateNameDecl(NamedDecl *D, bool AllowFunctionTemplates=true, bool AllowDependent=true)
Try to interpret the lookup result D as a template-name.
void AddArgumentDependentLookupCandidates(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, TemplateArgumentListInfo *ExplicitTemplateArgs, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add function candidates found via argument-dependent lookup to the set of overloading candidates.
bool AttachTypeConstraint(NestedNameSpecifierLoc NS, DeclarationNameInfo NameInfo, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs, TemplateTypeParmDecl *ConstrainedParameter, SourceLocation EllipsisLoc)
Attach a type-constraint to a template parameter.
void setFunctionHasBranchIntoScope()
Definition Sema.cpp:2240
bool CheckForConstantInitializer(Expr *e, QualType t)
type checking declaration initializers (C99 6.7.8)
ExprResult ActOnCUDAExecConfigExpr(Scope *S, SourceLocation LLLLoc, MultiExprArg ExecConfig, SourceLocation GGGLoc)
Definition SemaCUDA.cpp:50
bool CheckCallingConvAttr(const ParsedAttr &attr, CallingConv &CC, const FunctionDecl *FD=nullptr)
Decl * ActOnProperty(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, ObjCDeclSpec &ODS, Selector GetterSel, Selector SetterSel, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
ExprResult ActOnStartCXXMemberReference(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, ParsedType &ObjectType, bool &MayBePseudoDestructor)
StmtResult ActOnOpenMPTargetSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target simd' after parsing of the associated statement.
NamespaceDecl * getCachedCoroNamespace()
Definition Sema.h:5944
ExtVectorDeclsType ExtVectorDecls
ExtVectorDecls - This is a list all the extended vector types.
Definition Sema.h:831
ExprResult ActOnCaseExpr(SourceLocation CaseLoc, ExprResult Val)
Definition SemaStmt.cpp:458
void WarnExactTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
WarnExactTypedMethods - This routine issues a warning if method implementation declaration matches ex...
NamedDecl * BuildUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, SourceLocation NameLoc, EnumDecl *ED)
StmtResult ActOnOpenMPForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for' after parsing of the associated statement.
SourceLocation getOptimizeOffPragmaLocation() const
Get the location for the currently active "\#pragma clang optimizeoff". If this location is invalid,...
Definition Sema.h:10467
NamedDecl * HandleDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists)
ExprResult VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, VerifyICEDiagnoser &Diagnoser, AllowFoldKind CanFold=NoFold)
VerifyIntegerConstantExpression - Verifies that an expression is an ICE, and reports the appropriate ...
void ActOnPragmaMSComment(SourceLocation CommentLoc, PragmaMSCommentKind Kind, StringRef Arg)
ActOnPragmaMSComment - Called on well formed #pragma comment(kind, "arg").
Definition SemaAttr.cpp:505
TemplateParameterList * MatchTemplateParametersToScopeSpecifier(SourceLocation DeclStartLoc, SourceLocation DeclLoc, const CXXScopeSpec &SS, TemplateIdAnnotation *TemplateId, ArrayRef< TemplateParameterList * > ParamLists, bool IsFriend, bool &IsMemberSpecialization, bool &Invalid, bool SuppressDiagnostic=false)
Match the given template parameter lists to the given scope specifier, returning the template paramet...
virtual void anchor()
This virtual key function only exists to limit the emission of debug info describing the Sema class.
Definition Sema.cpp:258
void CodeCompleteObjCAtExpression(Scope *S)
QualType BuildExtVectorType(QualType T, Expr *ArraySize, SourceLocation AttrLoc)
Build an ext-vector type.
void handleTagNumbering(const TagDecl *Tag, Scope *TagScope)
SmallVector< AlignPackIncludeState, 8 > AlignPackIncludeStack
Definition Sema.h:687
void AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl)
AddImplicitlyDeclaredMembersToClass - Adds any implicitly-declared special functions,...
bool tryResolveExplicitSpecifier(ExplicitSpecifier &ExplicitSpec)
tryResolveExplicitSpecifier - Attempt to resolve the explict specifier.
SimplerImplicitMoveMode
Definition Sema.h:5050
Expr * BuildBuiltinCallExpr(SourceLocation Loc, Builtin::ID Id, MultiExprArg CallArgs)
BuildBuiltinCallExpr - Create a call to a builtin function specified by Id.
StmtResult ActOnOpenMPLoopnest(Stmt *AStmt)
Process a canonical OpenMP loop nest that can either be a canonical literal loop (ForStmt or CXXForRa...
void buildLambdaScope(sema::LambdaScopeInfo *LSI, CXXMethodDecl *CallOperator, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, bool ExplicitParams, bool ExplicitResultType, bool Mutable)
Endow the lambda scope info with the relevant properties.
void AddAlignmentAttributesForRecord(RecordDecl *RD)
AddAlignmentAttributesForRecord - Adds any needed alignment attributes to a the record decl,...
Definition SemaAttr.cpp:50
void PopParsingDeclaration(ParsingDeclState state, Decl *decl)
ErrorAttr * mergeErrorAttr(Decl *D, const AttributeCommonInfo &CI, StringRef NewUserDiagnostic)
Decl * ActOnConversionDeclarator(CXXConversionDecl *Conversion)
ActOnConversionDeclarator - Called by ActOnDeclarator to complete the declaration of the given C++ co...
void CheckMain(FunctionDecl *FD, const DeclSpec &D)
OMPClause * ActOnOpenMPSIMDClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'simd' clause.
void AddKnownFunctionAttributes(FunctionDecl *FD)
Adds any function attributes that we know a priori based on the declaration of this function.
ExprResult SubstInitializer(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs, bool CXXDirectInit)
ExprResult LookupInlineAsmIdentifier(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Id, bool IsUnevaluatedContext)
QualType CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool AllowBothBool, bool AllowBoolConversion, bool AllowBoolOperation, bool ReportInvalid)
type checking for vector binary operators.
llvm::SmallSetVector< DeclContext *, 16 > AssociatedNamespaceSet
Definition Sema.h:3841
void ActOnComment(SourceRange Comment)
Definition Sema.cpp:2337
ExprResult ActOnDesignatedInitializer(Designation &Desig, SourceLocation EqualOrColonLoc, bool GNUSyntax, ExprResult Init)
@ Other
C++ [dcl.fct.def.general]p1 function-body: ctor-initializer[opt] compound-statement function-try-bloc...
LiteralOperatorLookupResult LookupLiteralOperator(Scope *S, LookupResult &R, ArrayRef< QualType > ArgTys, bool AllowRaw, bool AllowTemplate, bool AllowStringTemplate, bool DiagnoseMissing, StringLiteral *StringLit=nullptr)
LookupLiteralOperator - Determine which literal operator should be used for a user-defined literal,...
QualType BuildStdInitializerList(QualType Element, SourceLocation Loc)
Looks for the std::initializer_list template and instantiates it with Element, or emits an error if i...
void CodeCompleteObjCPropertySynthesizeIvar(Scope *S, IdentifierInfo *PropertyName)
bool RequireStructuralType(QualType T, SourceLocation Loc)
Require the given type to be a structural type, and diagnose if it is not.
concepts::Requirement * ActOnSimpleRequirement(Expr *E)
llvm::SmallPtrSet< Selector, 8 > SelectorSet
Definition Sema.h:4625
MemInitResult BuildMemberInitializer(ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
StmtResult ActOnExprStmt(ExprResult Arg, bool DiscardedValue=true)
Definition SemaStmt.cpp:46
FieldDecl * HandleField(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS)
HandleField - Analyze a field of a C struct or a C++ data member.
OpaquePtr< TemplateName > TemplateTy
Definition Sema.h:401
void ActOnEndOfTranslationUnit()
ActOnEndOfTranslationUnit - This is called at the very end of the translation unit when EOF is reache...
Definition Sema.cpp:1105
llvm::DenseMap< NamedDecl *, NamedDecl * > VisibleNamespaceCache
Map from the most recent declaration of a namespace to the most recent visible declaration of that na...
Definition Sema.h:9127
void AddLaunchBoundsAttr(Decl *D, const AttributeCommonInfo &CI, Expr *MaxThreads, Expr *MinBlocks)
AddLaunchBoundsAttr - Adds a launch_bounds attribute to a particular declaration.
StmtResult ActOnOpenMPTargetParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for' after parsing of the associated statement.
FPOptionsOverride CurFPFeatureOverrides()
Definition Sema.h:696
void redelayDiagnostics(sema::DelayedDiagnosticPool &pool)
Given a set of delayed diagnostics, re-emit them as if they had been delayed in the current context i...
ExprResult ActOnOpenMPDeclareMapperDirectiveVarDecl(Scope *S, QualType MapperType, SourceLocation StartLoc, DeclarationName VN)
Build the mapper variable of '#pragma omp declare mapper'.
void DiagnoseHiddenVirtualMethods(CXXMethodDecl *MD)
Diagnose methods which overload virtual methods in a base class without overriding any.
bool isValidSveBitcast(QualType srcType, QualType destType)
Are the two types SVE-bitcast-compatible types? I.e.
ExprResult ActOnDependentIdExpression(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, bool isAddressOfOperand, const TemplateArgumentListInfo *TemplateArgs)
ActOnDependentIdExpression - Handle a dependent id-expression that was just parsed.
StmtResult ActOnOpenMPTaskwaitDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskwait'.
QualType NSNumberPointer
Pointer to NSNumber type (NSNumber *).
Definition Sema.h:1173
ObjCLiteralKind CheckLiteralKind(Expr *FromE)
void CodeCompleteLambdaIntroducer(Scope *S, LambdaIntroducer &Intro, bool AfterAmpersand)
QualType getCapturedDeclRefType(VarDecl *Var, SourceLocation Loc)
Given a variable, determine the type that a reference to that variable will have in the given scope.
FieldDecl * BuildCaptureField(RecordDecl *RD, const sema::Capture &Capture)
Build a FieldDecl suitable to hold the given capture.
TypeResult ActOnOpenMPDeclareMapperVarDecl(Scope *S, Declarator &D)
Check variable declaration in 'omp declare mapper' construct.
ObjCMethodDecl * LookupMethodInQualifiedType(Selector Sel, const ObjCObjectPointerType *OPT, bool IsInstance)
LookupMethodInQualifiedType - Lookups up a method in protocol qualifier list of a qualified objective...
concepts::Requirement * ActOnCompoundRequirement(Expr *E, SourceLocation NoexceptLoc)
void ActOnPragmaMSSeg(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, StringLiteral *SegmentName, llvm::StringRef PragmaName)
Called on well formed #pragma bss_seg/data_seg/const_seg/code_seg.
Definition SemaAttr.cpp:751
UsingShadowDecl * BuildUsingShadowDecl(Scope *S, BaseUsingDecl *BUD, NamedDecl *Target, UsingShadowDecl *PrevDecl)
Builds a shadow declaration corresponding to a 'using' declaration.
ExprResult BuildStmtExpr(SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc, unsigned TemplateDepth)
bool ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, const DeclSpec &DS, SourceLocation ColonColonLoc)
bool hasVisibleExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is an explicit specialization declaration for a...
TypeResult ActOnTypeName(Scope *S, Declarator &D)
bool IsInsideALocalClassWithinATemplateFunction()
ExprResult ActOnOMPArraySectionExpr(Expr *Base, SourceLocation LBLoc, Expr *LowerBound, SourceLocation ColonLocFirst, SourceLocation ColonLocSecond, Expr *Length, Expr *Stride, SourceLocation RBLoc)
ExprResult BuildOverloadedArrowExpr(Scope *S, Expr *Base, SourceLocation OpLoc, bool *NoArrowOperatorFound=nullptr)
BuildOverloadedArrowExpr - Build a call to an overloaded operator-> (if one exists),...
ExprResult BuildCallToMemberFunction(Scope *S, Expr *MemExpr, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallToMemberFunction - Build a call to a member function.
StmtResult ActOnOpenMPDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute parallel for simd' after parsing of the associated stat...
Decl * ActOnTemplateDeclarator(Scope *S, MultiTemplateParamsArg TemplateParameterLists, Declarator &D)
void ActOnTranslationUnitScope(Scope *S)
Definition Sema.cpp:124
void SubstExceptionSpec(FunctionDecl *New, const FunctionProtoType *Proto, const MultiLevelTemplateArgumentList &Args)
void ActOnReenterFunctionContext(Scope *S, Decl *D)
Push the parameters of D, which must be a function, into scope.
ExprResult BuildResolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, Expr *Awaiter, bool IsImplicit=false)
llvm::DenseMap< Decl *, SmallVector< PartialDiagnosticAt, 1 > > SuppressedDiagnosticsMap
For each declaration that involved template argument deduction, the set of diagnostics that were supp...
Definition Sema.h:9196
ExprResult ActOnSuperMessage(Scope *S, SourceLocation SuperLoc, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
DeclGroupPtrTy ActOnOpenMPRequiresDirective(SourceLocation Loc, ArrayRef< OMPClause * > ClauseList)
Called on well-formed '#pragma omp requires'.
void MarkDeclarationsReferencedInExpr(Expr *E, bool SkipLocalVariables=false, ArrayRef< const Expr * > StopAt=None)
Mark any declarations that appear within this expression or any potentially-evaluated subexpressions ...
bool isMemberAccessibleForDeletion(CXXRecordDecl *NamingClass, DeclAccessPair Found, QualType ObjectType, SourceLocation Loc, const PartialDiagnostic &Diag)
Is the given member accessible for the purposes of deciding whether to define a special member functi...
ObjCPropertyDecl * HandlePropertyInClassExtension(Scope *S, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, unsigned &Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind)
Called by ActOnProperty to handle @property declarations in class extensions.
ExprResult BuildVAArgExpr(SourceLocation BuiltinLoc, Expr *E, TypeSourceInfo *TInfo, SourceLocation RPLoc)
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec *SS=nullptr, bool isClassName=false, bool HasTrailingDot=false, ParsedType ObjectType=nullptr, bool IsCtorOrDtorName=false, bool WantNontrivialTypeSourceInfo=false, bool IsClassTemplateDeductionContext=true, IdentifierInfo **CorrectedII=nullptr)
If the identifier refers to a type name within this scope, return the declaration of that type.
Definition SemaDecl.cpp:286
IdentifierInfo * getSuperIdentifier() const
Definition Sema.cpp:2616
void startOpenMPLoop()
If the current region is a loop-based region, mark the start of the loop construct.
OMPClause * ActOnOpenMPDestroyClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'destroy' clause.
StmtResult BuildIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:950
ExprResult PerformContextualImplicitConversion(SourceLocation Loc, Expr *FromE, ContextualImplicitConverter &Converter)
Perform a contextual implicit conversion.
void ActOnPragmaFloatControl(SourceLocation Loc, PragmaMsStackAction Action, PragmaFloatControlKind Value)
ActOnPragmaFloatControl - Call on well-formed #pragma float_control.
Definition SemaAttr.cpp:548
StmtResult BuildObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw)
ExprResult UsualUnaryConversions(Expr *E)
UsualUnaryConversions - Performs various conversions that are common to most operators (C99 6....
Definition SemaExpr.cpp:770
void CodeCompleteObjCClassPropertyRefExpr(Scope *S, IdentifierInfo &ClassName, SourceLocation ClassNameLoc, bool IsBaseExprStatement)
LateParsedTemplateMapT LateParsedTemplateMap
Definition Sema.h:911
void UnmarkAsLateParsedTemplate(FunctionDecl *FD)
const AttributedType * getCallingConvAttributedType(QualType T) const
Get the outermost AttributedType node that sets a calling convention.
CheckTemplateArgumentKind
Specifies the context in which a particular template argument is being checked.
Definition Sema.h:8068
@ CTAK_DeducedFromArrayBound
The template argument was deduced from an array bound via template argument deduction.
Definition Sema.h:8079
@ CTAK_Specified
The template argument was specified in the code or was instantiated with some deduced template argume...
Definition Sema.h:8071
@ CTAK_Deduced
The template argument was deduced via template argument deduction.
Definition Sema.h:8075
OMPClause * ActOnOpenMPBindClause(OpenMPBindClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on a well-formed 'bind' clause.
bool SubstExprs(ArrayRef< Expr * > Exprs, bool IsCall, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< Expr * > &Outputs)
Substitute the given template arguments into a list of expressions, expanding pack expansions if requ...
BaseResult ActOnBaseSpecifier(Decl *classdecl, SourceRange SpecifierRange, const ParsedAttributesView &Attrs, bool Virtual, AccessSpecifier Access, ParsedType basetype, SourceLocation BaseLoc, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
TypeSpecifierType isTagName(IdentifierInfo &II, Scope *S)
isTagName() - This method is called for error recovery purposes only to determine if the specified na...
Definition SemaDecl.cpp:634
void ActOnFinishFunctionDeclarationDeclarator(Declarator &D)
Called after parsing a function declarator belonging to a function declaration.
void ActOnPragmaMSPointersToMembers(LangOptions::PragmaMSPointersToMembersKind Kind, SourceLocation PragmaLoc)
ActOnPragmaMSPointersToMembers - called on well formed #pragma pointers_to_members(representation met...
Definition SemaAttr.cpp:619
bool CheckRedeclarationExported(NamedDecl *New, NamedDecl *Old)
void CodeCompletePostfixExpression(Scope *S, ExprResult LHS, QualType PreferredType)
TypeResult actOnObjCTypeArgsAndProtocolQualifiers(Scope *S, SourceLocation Loc, ParsedType BaseType, SourceLocation TypeArgsLAngleLoc, ArrayRef< ParsedType > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< Decl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc)
Build a specialized and/or protocol-qualified Objective-C type.
ExprResult CheckUnevaluatedOperand(Expr *E)
llvm::DenseMap< const EnumDecl *, llvm::APInt > FlagBitsCache
A cache of the flags available in enumerations with the flag_bits attribute.
Definition Sema.h:1423
void CheckTemplatePartialSpecialization(ClassTemplatePartialSpecializationDecl *Partial)
void ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, Expr *defarg)
ActOnParamDefaultArgument - Check whether the default argument provided for a function parameter is w...
bool isInOpenMPTaskUntiedContext() const
Return true if currently in OpenMP task with untied clause context.
bool DisableTypoCorrection
Tracks whether we are in a context where typo correction is disabled.
Definition Sema.h:9485
void CheckConversionDeclarator(Declarator &D, QualType &R, StorageClass &SC)
CheckConversionDeclarator - Called by ActOnDeclarator to check the well-formednes of the conversion f...
Decl * BuildStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, StringLiteral *AssertMessageExpr, SourceLocation RParenLoc, bool Failed)
StmtResult ActOnOpenMPMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop' after parsing of the associated statement.
ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, bool ArrayForm, Expr *Operand)
ActOnCXXDelete - Parsed a C++ 'delete' expression.
VisibilityAttr * mergeVisibilityAttr(Decl *D, const AttributeCommonInfo &CI, VisibilityAttr::VisibilityType Vis)
ExprResult DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, FunctionDecl *FDecl)
DefaultVariadicArgumentPromotion - Like DefaultArgumentPromotion, but will create a trap if the resul...
void DiagnoseCommaOperator(const Expr *LHS, SourceLocation Loc)
DeclGroupPtrTy ActOnModuleDecl(SourceLocation StartLoc, SourceLocation ModuleLoc, ModuleDeclKind MDK, ModuleIdPath Path, ModuleIdPath Partition, ModuleImportState &ImportState)
The parser has processed a module-declaration that begins the definition of a module interface or imp...
CXXMethodDecl * startLambdaDefinition(CXXRecordDecl *Class, SourceRange IntroducerRange, TypeSourceInfo *MethodType, SourceLocation EndLoc, ArrayRef< ParmVarDecl * > Params, ConstexprSpecKind ConstexprKind, Expr *TrailingRequiresClause)
Start the definition of a lambda expression.
TemplateNameKind isTemplateName(Scope *S, CXXScopeSpec &SS, bool hasTemplateKeyword, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool &MemberOfUnknownSpecialization, bool Disambiguation=false)
ExprResult tryConvertExprToType(Expr *E, QualType Ty)
Try to convert an expression E to type Ty.
Decl * ActOnFileScopeAsmDecl(Expr *expr, SourceLocation AsmLoc, SourceLocation RParenLoc)
bool DeduceReturnType(FunctionDecl *FD, SourceLocation Loc, bool Diagnose=true)
bool IsAllowedCUDACall(const FunctionDecl *Caller, const FunctionDecl *Callee)
Determines whether Caller may invoke Callee, based on their CUDA host/device attributes.
Definition Sema.h:12733
StmtResult SubstStmt(Stmt *S, const MultiLevelTemplateArgumentList &TemplateArgs)
bool CheckMatrixCast(SourceRange R, QualType DestTy, QualType SrcTy, CastKind &Kind)
QualType CheckAddressOfOperand(ExprResult &Operand, SourceLocation OpLoc)
CheckAddressOfOperand - The operand of & must be either a function designator or an lvalue designatin...
ParsedTemplateArgument ActOnTemplateTypeArgument(TypeResult ParsedType)
Convert a parsed type into a parsed template argument.
ParmVarDecl * BuildParmVarDeclForTypedef(DeclContext *DC, SourceLocation Loc, QualType T)
Synthesizes a variable for a parameter arising from a typedef.
ExprResult CheckSwitchCondition(SourceLocation SwitchLoc, Expr *Cond)
bool DiagnoseUnknownTemplateName(const IdentifierInfo &II, SourceLocation IILoc, Scope *S, const CXXScopeSpec *SS, TemplateTy &SuggestedTemplate, TemplateNameKind &SuggestedKind)
Decl * ActOnCompatibilityAlias(SourceLocation AtCompatibilityAliasLoc, IdentifierInfo *AliasName, SourceLocation AliasLocation, IdentifierInfo *ClassName, SourceLocation ClassLocation)
ActOnCompatibilityAlias - this action is called after complete parsing of a @compatibility_alias decl...
ASTContext & Context
Definition Sema.h:409
StmtResult ActOnOpenMPTargetExitDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target exit data' after parsing of the associated statement.
ClassTemplateDecl * lookupCoroutineTraits(SourceLocation KwLoc, SourceLocation FuncLoc, NamespaceDecl *&Namespace)
Lookup 'coroutine_traits' in std namespace and std::experimental namespace.
static bool TooManyArguments(size_t NumParams, size_t NumArgs, bool PartialOverloading=false)
To be used for checking whether the arguments being passed to function exceeds the number of paramete...
Definition Sema.h:13397
bool IsQualificationConversion(QualType FromType, QualType ToType, bool CStyle, bool &ObjCLifetimeConversion)
IsQualificationConversion - Determines whether the conversion from an rvalue of type FromType to ToTy...
void diagnoseNullableToNonnullConversion(QualType DstType, QualType SrcType, SourceLocation Loc)
Warn if we're implicitly casting from a _Nullable pointer type to a _Nonnull one.
Definition Sema.cpp:570
bool ShouldSplatAltivecScalarInCast(const VectorType *VecTy)
QualType InvalidOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
the following "Check" methods will return a valid/converted QualType or a null QualType (indicating a...
bool DiagIfReachable(SourceLocation Loc, ArrayRef< const Stmt * > Stmts, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the statements's reachability analysis.
void FinalizeDeclaration(Decl *D)
FinalizeDeclaration - called by ParseDeclarationAfterDeclarator to perform any semantic actions neces...
ExprResult ActOnCoyieldExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPFinalClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'final' clause.
bool CheckTemplatePartialSpecializationArgs(SourceLocation Loc, TemplateDecl *PrimaryTemplate, unsigned NumExplicitArgs, ArrayRef< TemplateArgument > Args)
Check the non-type template arguments of a class template partial specialization according to C++ [te...
ExprResult ActOnCXXNullPtrLiteral(SourceLocation Loc)
ActOnCXXNullPtrLiteral - Parse 'nullptr'.
OMPClause * ActOnOpenMPMapClause(ArrayRef< OpenMPMapModifierKind > MapTypeModifiers, ArrayRef< SourceLocation > MapTypeModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, OpenMPMapClauseKind MapType, bool IsMapTypeImplicit, SourceLocation MapLoc, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, bool NoDiagnose=false, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'map' clause.
void ActOnCapturedRegionError()
void ActOnFinishDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnFinishDelayedCXXMethodDeclaration - We have finished processing the delayed method declaration f...
ARCConversionResult
Definition Sema.h:12355
@ ACR_unbridged
Definition Sema.h:12355
StmtResult ActOnOpenMPFlushDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp flush'.
ExprResult BuildCXXTypeId(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a C++ typeid expression with a type operand.
IdentifierSourceLocations TypoCorrectionFailures
A cache containing identifiers for which typo correction failed and their locations,...
Definition Sema.h:9496
FullExprArg MakeFullExpr(Expr *Arg, SourceLocation CC)
Definition Sema.h:4881
QualType BuildFunctionType(QualType T, MutableArrayRef< QualType > ParamTypes, SourceLocation Loc, DeclarationName Entity, const FunctionProtoType::ExtProtoInfo &EPI)
Build a function type.
QualType CheckShiftOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, bool IsCompAssign=false)
void ActOnPragmaUnused(const Token &Identifier, Scope *curScope, SourceLocation PragmaLoc)
ActOnPragmaUnused - Called on well-formed '#pragma unused'.
Definition SemaAttr.cpp:828
DeclarationNameInfo GetNameForDeclarator(Declarator &D)
GetNameForDeclarator - Determine the full declaration name for the given Declarator.
ExprResult PerformMemberExprBaseConversion(Expr *Base, bool IsArrow)
Perform conversions on the LHS of a member access expression.
bool InNonInstantiationSFINAEContext
Whether we are in a SFINAE context that is not associated with template instantiation.
Definition Sema.h:9134
ExprResult SubstExpr(Expr *E, const MultiLevelTemplateArgumentList &TemplateArgs)
void DiagnoseUnusedBackingIvarInAccessor(Scope *S, const ObjCImplementationDecl *ImplD)
DiagnoseUnusedBackingIvarInAccessor - Issue an 'unused' warning if ivar which backs the property is n...
void ActOnLambdaExplicitTemplateParameterList(SourceLocation LAngleLoc, ArrayRef< NamedDecl * > TParams, SourceLocation RAngleLoc, ExprResult RequiresClause)
This is called after parsing the explicit template parameter list on a lambda (if it exists) in C++2a...
OMPClause * ActOnOpenMPVarListClause(OpenMPClauseKind Kind, ArrayRef< Expr * > Vars, const OMPVarListLocTy &Locs, OpenMPVarListDataTy &Data)
ExprResult BuildQualifiedDeclarationNameExpr(CXXScopeSpec &SS, const DeclarationNameInfo &NameInfo, bool IsAddressOfOperand, const Scope *S, TypeSourceInfo **RecoveryTSI=nullptr)
BuildQualifiedDeclarationNameExpr - Build a C++ qualified declaration name, generally during template...
DiagnosticsEngine & getDiagnostics() const
Definition Sema.h:1622
static FormatStringType GetFormatStringType(const FormatAttr *Format)
ExprResult MaybeConvertParenListExprToParenExpr(Scope *S, Expr *ME)
This is not an AltiVec-style cast or or C++ direct-initialization, so turn the ParenListExpr into a s...
concepts::TypeRequirement * BuildTypeRequirement(TypeSourceInfo *Type)
bool checkAddressOfFunctionIsAvailable(const FunctionDecl *Function, bool Complain=false, SourceLocation Loc=SourceLocation())
Returns whether the given function's address can be taken or not, optionally emitting a diagnostic if...
OMPClause * ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'hint' clause.
ExprResult ActOnCXXThis(SourceLocation loc)
bool RequireLiteralType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2492
AccessResult CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag, QualType objectType=QualType())
ExprResult checkPseudoObjectAssignment(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opcode, Expr *LHS, Expr *RHS)
bool CheckCaseExpression(Expr *E)
bool hasAcceptableDefinition(NamedDecl *D, AcceptableKind Kind)
Definition Sema.h:2380
StmtResult ActOnObjCAutoreleasePoolStmt(SourceLocation AtLoc, Stmt *Body)
QualType ProduceTemplateArgumentSignatureHelp(TemplateTy, ArrayRef< ParsedTemplateArgument >, SourceLocation LAngleLoc)
bool isObjCPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType, bool &IncompatibleObjC)
isObjCPointerConversion - Determines whether this is an Objective-C pointer conversion.
DeclResult ActOnModuleImport(SourceLocation StartLoc, SourceLocation ExportLoc, SourceLocation ImportLoc, ModuleIdPath Path, bool IsPartition=false)
The parser has processed a module import declaration.
void CodeCompleteAfterIf(Scope *S, bool IsBracedThen)
bool currentModuleIsInterface() const
Is the module scope we are an interface?
Definition Sema.h:2291
static bool getPrintable(bool B)
Definition Sema.h:2144
bool LookupBuiltin(LookupResult &R)
Lookup a builtin function, when name lookup would otherwise fail.
std::string getFixItZeroLiteralForType(QualType T, SourceLocation Loc) const
void propagateDLLAttrToBaseClassTemplate(CXXRecordDecl *Class, Attr *ClassAttr, ClassTemplateSpecializationDecl *BaseTemplateSpec, SourceLocation BaseLoc)
Perform propagation of DLL attributes from a derived class to a templated base class for MS compatibi...
NamedDecl * ActOnFriendFunctionDecl(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParams)
void setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec, TypedefNameDecl *NewTD)
QualType CheckMatrixElementwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
Type checking for matrix binary operators.
bool tryToRecoverWithCall(ExprResult &E, const PartialDiagnostic &PD, bool ForceComplain=false, bool(*IsPlausibleResult)(QualType)=nullptr)
Try to recover by turning the given expression into a call.
Definition Sema.cpp:2571
OMPClause * ActOnOpenMPSimpleClause(OpenMPClauseKind Kind, unsigned Argument, SourceLocation ArgumentLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
FunctionDecl * ResolveAddressOfOverloadedFunction(Expr *AddressOfExpr, QualType TargetType, bool Complain, DeclAccessPair &Found, bool *pHadMultipleCandidates=nullptr)
ResolveAddressOfOverloadedFunction - Try to resolve the address of an overloaded function (C++ [over....
void ActOnSuperClassOfClassInterface(Scope *S, SourceLocation AtInterfaceLoc, ObjCInterfaceDecl *IDecl, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange)
DeclGroupPtrTy ActOnOpenMPThreadprivateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList)
Called on well-formed '#pragma omp threadprivate'.
void CheckDelayedMemberExceptionSpecs()
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType=nullptr)
Definition SemaDecl.cpp:57
void ActOnReenterCXXMethodParameter(Scope *S, ParmVarDecl *Param)
This is used to implement the constant expression evaluation part of the attribute enable_if extensio...
void InstantiateMemInitializers(CXXConstructorDecl *New, const CXXConstructorDecl *Tmpl, const MultiLevelTemplateArgumentList &TemplateArgs)
void PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext=true)
Add this decl to the scope shadowed decl chains.
void ActOnPragmaMSAllocText(SourceLocation PragmaLocation, StringRef Section, const SmallVector< std::tuple< IdentifierInfo *, SourceLocation > > &Functions)
Called on well-formed #pragma alloc_text().
Definition SemaAttr.cpp:792
ClassTemplateDecl * StdCoroutineTraitsCache
The C++ "std::coroutine_traits" template, which is defined in <coroutine_traits>
Definition Sema.h:1147
ExprResult ActOnSourceLocExpr(SourceLocExpr::IdentKind Kind, SourceLocation BuiltinLoc, SourceLocation RPLoc)
void LookupOverloadedOperatorName(OverloadedOperatorKind Op, Scope *S, UnresolvedSetImpl &Functions)
void checkSpecializationReachability(SourceLocation Loc, NamedDecl *Spec)
UnusedFileScopedDeclsType UnusedFileScopedDecls
The set of file scoped decls seen so far that have not been used and must warn if not used.
Definition Sema.h:884
ObjCInterfaceDecl * NSStringDecl
The declaration of the Objective-C NSString class.
Definition Sema.h:1182
bool hasVisibleDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a visible default argument.
void CleanupVarDeclMarking()
void CodeCompleteAvailabilityPlatformName()
bool CheckConstraintExpression(const Expr *CE, Token NextToken=Token(), bool *PossibleNonPrimary=nullptr, bool IsTrailingRequiresClause=false)
Check whether the given expression is a valid constraint expression.
TypeResult ActOnDependentTag(Scope *S, unsigned TagSpec, TagUseKind TUK, const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation TagLoc, SourceLocation NameLoc)
ExprResult DefaultFunctionArrayLvalueConversion(Expr *E, bool Diagnose=true)
Definition SemaExpr.cpp:736
ExprResult BuildSourceLocExpr(SourceLocExpr::IdentKind Kind, QualType ResultTy, SourceLocation BuiltinLoc, SourceLocation RPLoc, DeclContext *ParentContext)
bool isImmediateFunctionContext() const
Definition Sema.h:9414
NamedDecl * LazilyCreateBuiltin(IdentifierInfo *II, unsigned ID, Scope *S, bool ForRedeclaration, SourceLocation Loc)
LazilyCreateBuiltin - The specified Builtin-ID was first used at file scope.
ASTContext & getASTContext() const
Definition Sema.h:1625
std::unique_ptr< sema::FunctionScopeInfo, PoppedFunctionScopeDeleter > PoppedFunctionScopePtr
Definition Sema.h:1942
ExprResult CallExprUnaryConversions(Expr *E)
CallExprUnaryConversions - a special case of an unary conversion performed on a function designator o...
Definition SemaExpr.cpp:748
void translateTemplateArguments(const ASTTemplateArgsPtr &In, TemplateArgumentListInfo &Out)
Translates template arguments as provided by the parser into template arguments used by semantic anal...
void DeclareGlobalAllocationFunction(DeclarationName Name, QualType Return, ArrayRef< QualType > Params)
DeclareGlobalAllocationFunction - Declares a single implicit global allocation function if it doesn't...
void finalizeOpenMPDelayedAnalysis(const FunctionDecl *Caller, const FunctionDecl *Callee, SourceLocation Loc)
Finishes analysis of the deferred functions calls that may be declared as host/nohost during device/h...
ExprResult VerifyIntegerConstantExpression(Expr *E, AllowFoldKind CanFold=NoFold)
Definition Sema.h:12547
StmtResult ActOnOpenMPDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute simd' after parsing of the associated statement.
UnresolvedSetIterator getMostSpecialized(UnresolvedSetIterator SBegin, UnresolvedSetIterator SEnd, TemplateSpecCandidateSet &FailedCandidates, SourceLocation Loc, const PartialDiagnostic &NoneDiag, const PartialDiagnostic &AmbigDiag, const PartialDiagnostic &CandidateDiag, bool Complain=true, QualType TargetType=QualType())
Retrieve the most specialized of the given function template specializations.
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType)
IsIntegralPromotion - Determines whether the conversion from the expression From (whose potentially-a...
bool DiagnoseUnexpandedParameterPackInRequiresExpr(RequiresExpr *RE)
If the given requirees-expression contains an unexpanded reference to one of its own parameter packs,...
TypeSourceInfo * SubstType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, bool AllowDeducedTST=false)
Perform substitution on the type T with a given set of template arguments.
bool IsFloatingPointPromotion(QualType FromType, QualType ToType)
IsFloatingPointPromotion - Determines whether the conversion from FromType to ToType is a floating po...
FunctionTemplateDecl * getMoreSpecializedTemplate(FunctionTemplateDecl *FT1, FunctionTemplateDecl *FT2, SourceLocation Loc, TemplatePartialOrderingContext TPOC, unsigned NumCallArguments1, unsigned NumCallArguments2, bool Reversed=false, bool AllowOrderingByConstraints=true)
Returns the more specialized function template according to the rules of function template partial or...
void CheckObjCMethodOverrides(ObjCMethodDecl *ObjCMethod, ObjCInterfaceDecl *CurrentClass, ResultTypeCompatibilityKind RTC)
OMPClause * ActOnOpenMPSharedClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'shared' clause.
ClassTemplateDecl * StdInitializerList
The C++ "std::initializer_list" template, which is defined in <initializer_list>.
Definition Sema.h:1143
NamedDecl * LookupSingleName(Scope *S, DeclarationName Name, SourceLocation Loc, LookupNameKind NameKind, RedeclarationKind Redecl=NotForRedeclaration)
Look up a name, looking for a single declaration.
CXXDestructorDecl * LookupDestructor(CXXRecordDecl *Class)
Look for the destructor of the given class.
void CheckExplicitlyDefaultedFunction(Scope *S, FunctionDecl *MD)
StmtResult ActOnOpenMPTargetUpdateDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target update'.
ParsingDeclState PushParsingDeclaration(sema::DelayedDiagnosticPool &pool)
Definition Sema.h:5199
OMPClause * ActOnOpenMPInitClause(Expr *InteropVar, ArrayRef< Expr * > PrefExprs, bool IsTarget, bool IsTargetSync, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'init' clause.
StmtResult ActOnOpenMPSingleDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp single' after parsing of the associated statement.
void CodeCompleteObjCPropertyDefinition(Scope *S)
void ActOnPragmaAttributeAttribute(ParsedAttr &Attribute, SourceLocation PragmaLoc, attr::ParsedSubjectMatchRuleSet Rules)
Definition SemaAttr.cpp:928
bool isCurrentClassName(const IdentifierInfo &II, Scope *S, const CXXScopeSpec *SS=nullptr)
isCurrentClassName - Determine whether the identifier II is the name of the class type currently bein...
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for simd' after parsing of the as...
void MarkVariableReferenced(SourceLocation Loc, VarDecl *Var)
Mark a variable referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
ExprResult BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C class message expression.
bool IsRedefinitionInModule(const NamedDecl *New, const NamedDecl *Old) const
llvm::SetVector< Expr *, SmallVector< Expr *, 4 >, llvm::SmallPtrSet< Expr *, 4 > > MaybeODRUseExprSet
Store a set of either DeclRefExprs or MemberExprs that contain a reference to a variable (constant) t...
Definition Sema.h:788
Decl * ActOnStartExportDecl(Scope *S, SourceLocation ExportLoc, SourceLocation LBraceLoc)
We have parsed the start of an export declaration, including the '{' (if present).
void checkExceptionSpecification(bool IsTopLevel, ExceptionSpecificationType EST, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr, SmallVectorImpl< QualType > &Exceptions, FunctionProtoType::ExceptionSpecInfo &ESI)
Check the given exception-specification and update the exception specification information with the r...
OMPClause * ActOnOpenMPCaptureClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'capture' clause.
void LookupBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, UnresolvedSetImpl &Functions)
NameClassificationKind
Describes the result of the name lookup and resolution performed by ClassifyName().
Definition Sema.h:2560
@ NC_Unknown
This name is not a type or template in this context, but might be something else.
Definition Sema.h:2563
@ NC_VarTemplate
The name was classified as a variable template name.
Definition Sema.h:2590
@ NC_NonType
The name was classified as a specific non-type, non-template declaration.
Definition Sema.h:2573
@ NC_TypeTemplate
The name was classified as a template whose specializations are types.
Definition Sema.h:2588
@ NC_Error
Classification failed; an error has been produced.
Definition Sema.h:2565
@ NC_FunctionTemplate
The name was classified as a function template name.
Definition Sema.h:2592
@ NC_DependentNonType
The name denotes a member of a dependent type that could not be resolved.
Definition Sema.h:2581
@ NC_UndeclaredNonType
The name was classified as an ADL-only function name.
Definition Sema.h:2577
@ NC_UndeclaredTemplate
The name was classified as an ADL-only function template name.
Definition Sema.h:2594
@ NC_Keyword
The name has been typo-corrected to a keyword.
Definition Sema.h:2567
@ NC_Type
The name was classified as a type.
Definition Sema.h:2569
@ NC_OverloadSet
The name was classified as an overload set, and an expression representing that overload set has been...
Definition Sema.h:2586
@ NC_Concept
The name was classified as a concept name.
Definition Sema.h:2596
bool checkThisInStaticMemberFunctionType(CXXMethodDecl *Method)
Check whether 'this' shows up in the type of a static member function after the (naturally empty) cv-...
ExprResult BuildTemplateIdExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, bool RequiresADL, const TemplateArgumentListInfo *TemplateArgs)
void DiagnoseUnguardedAvailabilityViolations(Decl *FD)
Issue any -Wunguarded-availability warnings in FD.
void PopExpressionEvaluationContext()
AssignConvertType CheckTransparentUnionArgumentConstraints(QualType ArgType, ExprResult &RHS)
NamespaceDecl * getOrCreateStdNamespace()
Retrieve the special "std" namespace, which may require us to implicitly define the namespace.
ExprResult CreateOverloadedBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, bool RequiresADL=true, bool AllowRewrittenCandidates=true, FunctionDecl *DefaultedFn=nullptr)
Create a binary operation that may resolve to an overloaded operator.
PragmaStack< StringLiteral * > ConstSegStack
Definition Sema.h:691
StmtResult ActOnSEHTryBlock(bool IsCXXTry, SourceLocation TryLoc, Stmt *TryBlock, Stmt *Handler)
void ActOnPragmaOptionsAlign(PragmaOptionsAlignKind Kind, SourceLocation PragmaLoc)
ActOnPragmaOptionsAlign - Called on well formed #pragma options align.
Definition SemaAttr.cpp:215
ExprResult DefaultArgumentPromotion(Expr *E)
DefaultArgumentPromotion (C99 6.5.2.2p6).
Definition SemaExpr.cpp:853
bool isInitListConstructor(const FunctionDecl *Ctor)
Determine whether Ctor is an initializer-list constructor, as defined in [dcl.init....
void ActOnStartFunctionDeclarationDeclarator(Declarator &D, unsigned TemplateParameterDepth)
Called before parsing a function declarator belonging to a function declaration.
ExprResult ActOnPseudoDestructorExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, UnqualifiedId &FirstTypeName, SourceLocation CCLoc, SourceLocation TildeLoc, UnqualifiedId &SecondTypeName)
bool isMicrosoftMissingTypename(const CXXScopeSpec *SS, Scope *S)
isMicrosoftMissingTypename - In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal...
Definition SemaDecl.cpp:667
bool isConstantEvaluatedOverride
Used to change context to isConstantEvaluated without pushing a heavy ExpressionEvaluationContextReco...
Definition Sema.h:1039
StmtResult ActOnOpenMPRegionEnd(StmtResult S, ArrayRef< OMPClause * > Clauses)
End of OpenMP region.
ParsingClassState PushParsingClass()
Definition Sema.h:5205
SmallVector< VarDecl *, 4 > ExternalDeclarations
All the external declarations encoutered and used in the TU.
Definition Sema.h:876
bool checkInitMethod(ObjCMethodDecl *method, QualType receiverTypeIfCall)
Check whether the given method, which must be in the 'init' family, is a valid member of that family.
@ FRS_Success
Definition Sema.h:4047
@ FRS_DiagnosticIssued
Definition Sema.h:4049
@ FRS_NoViableFunction
Definition Sema.h:4048
bool UseArgumentDependentLookup(const CXXScopeSpec &SS, const LookupResult &R, bool HasTrailingLParen)
void ActOnPragmaFPExceptions(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called on well formed '#pragma clang fp' that has option 'exceptions'.
void InstantiateVariableDefinition(SourceLocation PointOfInstantiation, VarDecl *Var, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given variable from its template.
void inferGslPointerAttribute(NamedDecl *ND, CXXRecordDecl *UnderlyingRecord)
Add gsl::Pointer attribute to std::container::iterator.
Definition SemaAttr.cpp:108
ExprResult BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, SourceLocation RParenLoc, Expr *LiteralExpr)
ExprResult ActOnAddrLabel(SourceLocation OpLoc, SourceLocation LabLoc, LabelDecl *TheDecl)
ActOnAddrLabel - Parse the GNU address of label extension: "&&foo".
void MarkAsLateParsedTemplate(FunctionDecl *FD, Decl *FnD, CachedTokens &Toks)
StmtResult ActOnOpenMPParallelMaskedTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop' after parsing of the associated statemen...
AccessResult CheckAllocationAccess(SourceLocation OperatorLoc, SourceRange PlacementRange, CXXRecordDecl *NamingClass, DeclAccessPair FoundDecl, bool Diagnose=true)
Checks access to an overloaded operator new or delete.
void CodeCompleteUsingDirective(Scope *S)
std::string getAmbiguousPathsDisplayString(CXXBasePaths &Paths)
Builds a string representing ambiguous paths from a specific derived class to different subobjects of...
unsigned TyposCorrected
The number of typos corrected by CorrectTypo.
Definition Sema.h:9488
SemaDiagnosticBuilder diagIfOpenMPDeviceCode(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
StmtResult ActOnOpenMPTargetParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target parallel' after parsing of the associated statement.
bool checkVarDeclRedefinition(VarDecl *OldDefn, VarDecl *NewDefn)
We've just determined that Old and New both appear to be definitions of the same variable.
DefaultedComparisonKind
Kinds of defaulted comparison operator functions.
Definition Sema.h:1527
@ Relational
This is an <, <=, >, or >= that should be implemented as a rewrite in terms of a <=> comparison.
@ NotEqual
This is an operator!= that should be implemented as a rewrite in terms of a == comparison.
@ ThreeWay
This is an operator<=> that should be implemented as a series of subobject comparisons.
@ None
This is not a defaultable comparison operator.
@ Equal
This is an operator== that should be implemented as a series of subobject comparisons.
AccessResult CheckMemberOperatorAccess(SourceLocation Loc, Expr *ObjectExpr, const SourceRange &, DeclAccessPair FoundDecl)
Expr * recreateSyntacticForm(PseudoObjectExpr *E)
Given a pseudo-object expression, recreate what it looks like syntactically without the attendant Opa...
ExprResult ActOnParenListExpr(SourceLocation L, SourceLocation R, MultiExprArg Val)
ExprResult ActOnArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, ParsedType LhsTy, Expr *DimExpr, SourceLocation RParen)
ActOnArrayTypeTrait - Parsed one of the binary type trait support pseudo-functions.
QualType ExtractUnqualifiedFunctionType(QualType PossiblyAFunctionType)
llvm::SmallVector< QualType, 4 > CurrentParameterCopyTypes
Stack of types that correspond to the parameter entities that are currently being copy-initialized.
Definition Sema.h:1552
bool IsPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType, bool &IncompatibleObjC)
IsPointerConversion - Determines whether the conversion of the expression From, which has the (possib...
bool RequireLiteralType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
Ensure that the type T is a literal type.
AllowedExplicit
Definition Sema.h:3639
@ Conversions
Allow explicit conversion functions but not explicit constructors.
@ All
Allow both explicit conversion functions and explicit constructors.
void ActOnFinishRequiresExpr()
void MatchAllMethodDeclarations(const SelectorSet &InsMap, const SelectorSet &ClsMap, SelectorSet &InsMapSeen, SelectorSet &ClsMapSeen, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool &IncompleteImpl, bool ImmediateClass, bool WarnCategoryMethodImpl=false)
MatchAllMethodDeclarations - Check methods declaraed in interface or or protocol against those declar...
bool checkSYCLDeviceFunction(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition SemaSYCL.cpp:36
static const unsigned MaxAlignmentExponent
The maximum alignment, same as in llvm::Value.
Definition Sema.h:397
QualType CheckMatrixMultiplyOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign)
void CheckObjCMethodDirectOverrides(ObjCMethodDecl *method, ObjCMethodDecl *overridden)
void ActOnStartCXXInClassMemberInitializer()
Enter a new C++ default initializer scope.
void * SaveNestedNameSpecifierAnnotation(CXXScopeSpec &SS)
Given a C++ nested-name-specifier, produce an annotation value that the parser can use later to recon...
llvm::MapVector< const FunctionDecl *, std::unique_ptr< LateParsedTemplate > > LateParsedTemplateMapT
Definition Sema.h:910
void ProcessPragmaWeak(Scope *S, Decl *D)
bool shouldIgnoreInHostDeviceCheck(FunctionDecl *Callee)
void CodeCompleteTypeQualifiers(DeclSpec &DS)
NamedDecl * BuildUsingDeclaration(Scope *S, AccessSpecifier AS, SourceLocation UsingLoc, bool HasTypenameKeyword, SourceLocation TypenameLoc, CXXScopeSpec &SS, DeclarationNameInfo NameInfo, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList, bool IsInstantiation, bool IsUsingIfExists)
Builds a using declaration.
void AddXConsumedAttr(Decl *D, const AttributeCommonInfo &CI, RetainOwnershipKind K, bool IsTemplateInstantiation)
ParsedType ActOnObjCInstanceType(SourceLocation Loc)
The parser has parsed the context-sensitive type 'instancetype' in an Objective-C message declaration...
PrintingPolicy getPrintingPolicy() const
Retrieve a suitable printing policy for diagnostics.
Definition Sema.h:3179
std::string getFixItZeroInitializerForType(QualType T, SourceLocation Loc) const
Get a string to suggest for zero-initialization of a type.
bool IsComplexPromotion(QualType FromType, QualType ToType)
Determine if a conversion is a complex promotion.
Decl * BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, AccessSpecifier AS, RecordDecl *Record, const PrintingPolicy &Policy)
BuildAnonymousStructOrUnion - Handle the declaration of an anonymous structure or union.
bool FunctionParamTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos=nullptr, bool Reversed=false)
FunctionParamTypesAreEqual - This routine checks two function proto types for equality of their param...
void ActOnPragmaFPEvalMethod(SourceLocation Loc, LangOptions::FPEvalMethodKind Value)
Definition SemaAttr.cpp:521
ExprResult BuildObjCBridgedCast(SourceLocation LParenLoc, ObjCBridgeCastKind Kind, SourceLocation BridgeKeywordLoc, TypeSourceInfo *TSInfo, Expr *SubExpr)
bool isOpenMPGlobalCapturedDecl(ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified global variable must be captured by outer capture regions.
Module * getOwningModule(const Decl *Entity)
Get the module owning an entity.
Definition Sema.h:2296
bool SubstTemplateArguments(ArrayRef< TemplateArgumentLoc > Args, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateArgumentListInfo &Outputs)
bool CheckAttrNoArgs(const ParsedAttr &CurrAttr)
ObjCMethodDecl * getCurMethodDecl()
getCurMethodDecl - If inside of a method body, this returns a pointer to the method decl for the meth...
Definition Sema.cpp:1445
bool isAcceptableTagRedeclaration(const TagDecl *Previous, TagTypeKind NewTag, bool isDefinition, SourceLocation NewTagLoc, const IdentifierInfo *Name)
Determine whether a tag with a given kind is acceptable as a redeclaration of the given tag declarati...
ExprResult ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *expr)
ActOnCXXThrow - Parse throw expressions.
sema::LambdaScopeInfo * getCurGenericLambda()
Retrieve the current generic lambda info, if any.
Definition Sema.cpp:2328
unsigned InventedParameterInfosStart
The index of the first InventedParameterInfo that refers to the current context.
Definition Sema.h:816
void MarkTypoCorrectedFunctionDefinition(const NamedDecl *F)
DeclRefExpr * BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, SourceLocation Loc, const CXXScopeSpec *SS=nullptr)
ExprResult CheckConvertedConstantExpression(Expr *From, QualType T, llvm::APSInt &Value, CCEKind CCE)
bool CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &Arg, NamedDecl *Template, SourceLocation TemplateLoc, SourceLocation RAngleLoc, unsigned ArgumentPackIndex, SmallVectorImpl< TemplateArgument > &Converted, CheckTemplateArgumentKind CTAK=CTAK_Specified)
Check that the given template argument corresponds to the given template parameter.
StmtResult ActOnOpenMPParallelMasterDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel master' after parsing of the associated statement.
unsigned NumSFINAEErrors
The number of SFINAE diagnostics that have been trapped.
Definition Sema.h:1437
void CodeCompleteObjCMethodDecl(Scope *S, Optional< bool > IsInstanceMethod, ParsedType ReturnType)
void setFunctionHasIndirectGoto()
Definition Sema.cpp:2250
void HandleDependentAccessCheck(const DependentDiagnostic &DD, const MultiLevelTemplateArgumentList &TemplateArgs)
void DefineImplicitMoveConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitMoveConstructor - Checks for feasibility of defining this constructor as the move const...
QualType BuildBitIntType(bool IsUnsigned, Expr *BitWidth, SourceLocation Loc)
Build a bit-precise integer type.
TemplateParameterListEqualKind
Enumeration describing how template parameter lists are compared for equality.
Definition Sema.h:8151
@ TPL_TemplateTemplateParmMatch
We are matching the template parameter lists of two template template parameters as part of matching ...
Definition Sema.h:8169
@ TPL_TemplateTemplateArgumentMatch
We are matching the template parameter lists of a template template argument against the template par...
Definition Sema.h:8180
@ TPL_TemplateMatch
We are matching the template parameter lists of two templates that might be redeclarations.
Definition Sema.h:8159
ExprResult ActOnChooseExpr(SourceLocation BuiltinLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr, SourceLocation RPLoc)
NamedDecl * ActOnTypeParameter(Scope *S, bool Typename, SourceLocation EllipsisLoc, SourceLocation KeyLoc, IdentifierInfo *ParamName, SourceLocation ParamNameLoc, unsigned Depth, unsigned Position, SourceLocation EqualLoc, ParsedType DefaultArg, bool HasTypeConstraint)
ActOnTypeParameter - Called when a C++ template type parameter (e.g., "typename T") has been parsed.
StmtResult ActOnOpenMPTargetDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target' after parsing of the associated statement.
ExprResult PerformObjectArgumentInitialization(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, CXXMethodDecl *Method)
PerformObjectArgumentInitialization - Perform initialization of the implicit object parameter for the...
SmallVectorImpl< Decl * > & WeakTopLevelDecls()
WeakTopLevelDeclDecls - access to #pragma weak-generated Decls.
Definition Sema.h:1994
EnumDecl * getStdAlignValT() const
void ActOnFinishDelayedMemberDeclarations(Scope *S, Decl *Record)
StmtResult ActOnOpenMPCancelDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, OpenMPDirectiveKind CancelRegion)
Called on well-formed '#pragma omp cancel'.
LangAS getDefaultCXXMethodAddrSpace() const
Returns default addr space for method qualifiers.
Definition Sema.cpp:1459
ExprResult BuildCaptureInit(const sema::Capture &Capture, SourceLocation ImplicitCaptureLoc, bool IsOpenMPMapping=false)
Initialize the given capture with a suitable expression.
LazyDeclPtr StdBadAlloc
The C++ "std::bad_alloc" class, which is defined by the C++ standard library.
Definition Sema.h:1131
void ActOnPragmaClangSection(SourceLocation PragmaLoc, PragmaClangSectionAction Action, PragmaClangSectionKind SecKind, StringRef SecName)
ActOnPragmaClangSection - Called on well formed #pragma clang section.
Definition SemaAttr.cpp:272
bool IsBlockPointerConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
CastKind PrepareCastToObjCObjectPointer(ExprResult &E)
Prepare a conversion of the given expression to an ObjC object pointer type.
OMPClause * ActOnOpenMPUntiedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'untied' clause.
bool CheckFunctionTemplateSpecialization(FunctionDecl *FD, TemplateArgumentListInfo *ExplicitTemplateArgs, LookupResult &Previous, bool QualifiedFriend=false)
Perform semantic analysis for the given function template specialization.
void FindAssociatedClassesAndNamespaces(SourceLocation InstantiationLoc, ArrayRef< Expr * > Args, AssociatedNamespaceSet &AssociatedNamespaces, AssociatedClassSet &AssociatedClasses)
Find the associated classes and namespaces for argument-dependent lookup for a call with the given se...
AssumedTemplateKind
Definition Sema.h:7756
@ FoundFunctions
This is assumed to be a template name because lookup found one or more functions (but no function tem...
@ FoundNothing
This is assumed to be a template name because lookup found nothing.
void AddMethodTemplateCandidate(FunctionTemplateDecl *MethodTmpl, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, TemplateArgumentListInfo *ExplicitTemplateArgs, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, OverloadCandidateParamOrder PO={})
Add a C++ member function template as a candidate to the candidate set, using template argument deduc...
bool UnifySection(StringRef SectionName, int SectionFlags, NamedDecl *TheDecl)
Definition SemaAttr.cpp:697
DeclContext * getFunctionLevelDeclContext(bool AllowLambda=false)
If AllowLambda is true, treat lambda as function.
Definition Sema.cpp:1420
void MergeVarDeclTypes(VarDecl *New, VarDecl *Old, bool MergeTypeWithOld)
MergeVarDeclTypes - We parsed a variable 'New' which has the same name and scope as a previous declar...
bool isModuleDirectlyImported(const Module *M)
Definition Sema.h:2300
llvm::DenseMap< IdentifierInfo *, AsmLabelAttr * > ExtnameUndeclaredIdentifiers
ExtnameUndeclaredIdentifiers - Identifiers contained in #pragma redefine_extname before declared.
Definition Sema.h:1106
void CodeCompleteInPreprocessorConditionalExclusion(Scope *S)
QualType NSValuePointer
Pointer to NSValue type (NSValue *).
Definition Sema.h:1176
QualType BuildQualifiedType(QualType T, SourceLocation Loc, Qualifiers Qs, const DeclSpec *DS=nullptr)
void DiagnoseSelfMove(const Expr *LHSExpr, const Expr *RHSExpr, SourceLocation OpLoc)
Warn if a value is moved to itself.
ExprResult ActOnOpenMPIdExpression(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id, OpenMPDirectiveKind Kind)
Called on correct id-expression from the '#pragma omp threadprivate'.
void CodeCompleteExpression(Scope *S, const CodeCompleteExpressionData &Data)
Perform code-completion in an expression context when we know what type we're looking for.
bool InstantiateClassTemplateSpecialization(SourceLocation PointOfInstantiation, ClassTemplateSpecializationDecl *ClassTemplateSpec, TemplateSpecializationKind TSK, bool Complain=true)
OMPClause * ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, SourceLocation IdLoc=SourceLocation())
Check declaration inside target region.
OMPClause * ActOnOpenMPUpdateClause(OpenMPDependClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'update' clause.
bool isSameOrCompatibleFunctionType(QualType Param, QualType Arg)
Compare types for equality with respect to possibly compatible function types (noreturn adjustment,...
ExprResult PerformOpenMPImplicitIntegerConversion(SourceLocation OpLoc, Expr *Op)
StmtResult ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Stmt *Body)
AtomicArgumentOrder
Definition Sema.h:5718
void PushFunctionScope()
Enter a new function scope.
Definition Sema.cpp:2074
ExprResult ActOnNameClassifiedAsNonType(Scope *S, const CXXScopeSpec &SS, NamedDecl *Found, SourceLocation NameLoc, const Token &NextToken)
Act on the result of classifying a name as a specific non-type declaration.
bool RebuildNestedNameSpecifierInCurrentInstantiation(CXXScopeSpec &SS)
ExprResult ActOnBuiltinBitCastExpr(SourceLocation KWLoc, Declarator &Dcl, ExprResult Operand, SourceLocation RParenLoc)
Definition SemaCast.cpp:382
void EmitCurrentDiagnostic(unsigned DiagID)
Cause the active diagnostic on the DiagosticsEngine to be emitted.
Definition Sema.cpp:1465
SourceRange getExprRange(Expr *E) const
Definition SemaExpr.cpp:493
bool ActOnCXXGlobalScopeSpecifier(SourceLocation CCLoc, CXXScopeSpec &SS)
The parser has parsed a global nested-name-specifier '::'.
void CheckDeductionGuideDeclarator(Declarator &D, QualType &R, StorageClass &SC)
Check the validity of a declarator that we parsed for a deduction-guide.
void SetDeclDefaulted(Decl *dcl, SourceLocation DefaultLoc)
NamedReturnInfo getNamedReturnInfo(Expr *&E, SimplerImplicitMoveMode Mode=SimplerImplicitMoveMode::Normal)
Determine whether the given expression might be move-eligible or copy-elidable in either a (co_)retur...
ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection)
void setExceptionMode(SourceLocation Loc, LangOptions::FPExceptionModeKind)
Called to set exception behavior for floating point operations.
bool ActOnCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
The parser has parsed a nested-name-specifier 'identifier::'.
void PrintPragmaAttributeInstantiationPoint()
bool CheckFunctionReturnType(QualType T, SourceLocation Loc)
OMPClause * ActOnOpenMPFirstprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'firstprivate' clause.
ArrayRef< InventedTemplateParameterInfo > getInventedParameterInfos() const
Definition Sema.h:818
void CheckImplementationIvars(ObjCImplementationDecl *ImpDecl, ObjCIvarDecl **Fields, unsigned nIvars, SourceLocation Loc)
CheckImplementationIvars - This routine checks if the instance variables listed in the implelementati...
void inferGslOwnerPointerAttribute(CXXRecordDecl *Record)
Add [[gsl::Owner]] and [[gsl::Pointer]] attributes for std:: types.
Definition SemaAttr.cpp:164
void tryCaptureOpenMPLambdas(ValueDecl *V)
Function tries to capture lambda's captured variables in the OpenMP region before the original lambda...
bool CheckMemberPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess)
CheckMemberPointerConversion - Check the member pointer conversion from the expression From to the ty...
void DefineImplicitCopyConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitCopyConstructor - Checks for feasibility of defining this constructor as the copy const...
void LateTemplateParserCleanupCB(void *P)
Definition Sema.h:915
static DeclarationName getPrintable(DeclarationName N)
Definition Sema.h:2151
StmtResult ActOnOpenMPDepobjDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp depobj'.
bool CheckEnumUnderlyingType(TypeSourceInfo *TI)
Check that this is a valid underlying type for an enum declaration.
bool checkLiteralOperatorId(const CXXScopeSpec &SS, const UnqualifiedId &Id, bool IsUDSuffix)
void DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID)
DiagnoseUnusedExprResult - If the statement passed in is an expression whose result is unused,...
Definition SemaStmt.cpp:219
FPOptions & getCurFPFeatures()
Definition Sema.h:1620
RecordDecl * StdSourceLocationImplDecl
The C++ "std::source_location::__impl" struct, defined in <source_location>.
Definition Sema.h:1161
void SetLateTemplateParser(LateTemplateParserCB *LTP, LateTemplateParserCleanupCB *LTPCleanup, void *P)
Definition Sema.h:920
ConditionResult ActOnCondition(Scope *S, SourceLocation Loc, Expr *SubExpr, ConditionKind CK, bool MissingOK=false)
SourceLocation getLocForEndOfToken(SourceLocation Loc, unsigned Offset=0)
Calls Lexer::getLocForEndOfToken()
Definition Sema.cpp:55
sema::LambdaScopeInfo * PushLambdaScope()
Definition Sema.cpp:2091
StmtResult ActOnCoreturnStmt(Scope *S, SourceLocation KwLoc, Expr *E)
void CheckTollFreeBridgeCast(QualType castType, Expr *castExpr)
void InstantiateAttrs(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
StmtResult ActOnOpenMPInteropDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp interop'.
void PopCompoundScope()
Definition Sema.cpp:2227
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2446
bool isObjCMethodDecl(Decl *D)
Definition Sema.h:3016
void CodeCompleteQualifiedId(Scope *S, CXXScopeSpec &SS, bool EnteringContext, bool IsUsingDeclaration, QualType BaseType, QualType PreferredType)
UnexpandedParameterPackContext
The context in which an unexpanded parameter pack is being diagnosed.
Definition Sema.h:8326
@ UPPC_FixedUnderlyingType
The fixed underlying type of an enumeration.
Definition Sema.h:8346
@ UPPC_RequiresClause
Definition Sema.h:8394
@ UPPC_UsingDeclaration
A using declaration.
Definition Sema.h:8352
@ UPPC_IfExists
Microsoft __if_exists.
Definition Sema.h:8376
@ UPPC_Requirement
Definition Sema.h:8391
@ UPPC_ExceptionType
The type of an exception.
Definition Sema.h:8370
@ UPPC_EnumeratorValue
The enumerator value.
Definition Sema.h:8349
@ UPPC_Lambda
Lambda expression.
Definition Sema.h:8382
@ UPPC_IfNotExists
Microsoft __if_not_exists.
Definition Sema.h:8379
@ UPPC_PartialSpecialization
Partial specialization.
Definition Sema.h:8373
@ UPPC_Initializer
An initializer.
Definition Sema.h:8361
@ UPPC_BaseType
The base type of a class type.
Definition Sema.h:8331
@ UPPC_FriendDeclaration
A friend declaration.
Definition Sema.h:8355
@ UPPC_DefaultArgument
A default argument.
Definition Sema.h:8364
@ UPPC_DeclarationType
The type of an arbitrary declaration.
Definition Sema.h:8334
@ UPPC_Expression
An arbitrary expression.
Definition Sema.h:8328
@ UPPC_DeclarationQualifier
A declaration qualifier.
Definition Sema.h:8358
@ UPPC_DataMemberType
The type of a data member.
Definition Sema.h:8337
@ UPPC_StaticAssertExpression
The expression in a static assertion.
Definition Sema.h:8343
@ UPPC_Block
Block expression.
Definition Sema.h:8385
@ UPPC_BitFieldWidth
The size of a bit-field.
Definition Sema.h:8340
@ UPPC_NonTypeTemplateParameterType
The type of a non-type template parameter.
Definition Sema.h:8367
@ UPPC_TypeConstraint
A type constraint.
Definition Sema.h:8388
ObjCMethodDecl * ValueWithBytesObjCTypeMethod
The declaration of the valueWithBytes:objCType: method.
Definition Sema.h:1191
StmtResult ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg Catch, Stmt *Finally)
void addInitCapture(sema::LambdaScopeInfo *LSI, VarDecl *Var)
Add an init-capture to a lambda scope.
void AddAnyMethodToGlobalPool(Decl *D)
AddAnyMethodToGlobalPool - Add any method, instance or factory to global pool.
CXXConstructorDecl * LookupDefaultConstructor(CXXRecordDecl *Class)
Look up the default constructor for the given class.
QualType BuildTypeofExprType(Expr *E)
void checkAllowedCUDAInitializer(VarDecl *VD)
Definition SemaCUDA.cpp:609
void DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc, ArrayRef< Expr * > Args)
DiagnoseSentinelCalls - This routine checks whether a call or message-send is to a declaration with t...
Definition SemaExpr.cpp:402
const LangOptions & getLangOpts() const
Definition Sema.h:1618
TypoCorrection CorrectTypo(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr, bool RecordFailure=true)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
RecordDecl * CFError
The struct behind the CFErrorRef pointer.
Definition Sema.h:13351
QualType CheckComparisonCategoryType(ComparisonCategoryType Kind, SourceLocation Loc, ComparisonCategoryUsage Usage)
Lookup the specified comparison category types in the standard library, an check the VarDecls possibl...
void DiagnoseTypeArgsAndProtocols(IdentifierInfo *ProtocolId, SourceLocation ProtocolLoc, IdentifierInfo *TypeArgId, SourceLocation TypeArgLoc, bool SelectProtocolFirst=false)
bool isDeductionGuideName(Scope *S, const IdentifierInfo &Name, SourceLocation NameLoc, ParsedTemplateTy *Template=nullptr)
Determine whether a particular identifier might be the name in a C++1z deduction-guide declaration.
ExprResult BuildSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, TypeSourceInfo *TSI)
bool RequireCompleteExprType(Expr *E, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type of the given expression is complete.
bool RebuildTemplateParamsInCurrentInstantiation(TemplateParameterList *Params)
Rebuild the template parameters now that we know we're in a current instantiation.
SpecialMemberOverloadResult LookupSpecialMember(CXXRecordDecl *D, CXXSpecialMember SM, bool ConstArg, bool VolatileArg, bool RValueThis, bool ConstThis, bool VolatileThis)
void DiagnoseInvalidJumps(Stmt *Body)
bool CaptureHasSideEffects(const sema::Capture &From)
Does copying/destroying the captured variable have side effects?
OMPClause * ActOnOpenMPAcquireClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acquire' clause.
void ActOnOpenMPDeclareReductionCombinerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
TemplateDeductionResult DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, const TemplateArgumentList &TemplateArgs, sema::TemplateDeductionInfo &Info)
Perform template argument deduction to determine whether the given template arguments match the given...
void DiagnoseAbsenceOfOverrideControl(NamedDecl *D, bool Inconsistent)
DiagnoseAbsenceOfOverrideControl - Diagnose if 'override' keyword was not used in the declaration of ...
StmtResult ActOnFinishFullStmt(Stmt *Stmt)
void DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D)
SmallVector< VTableUse, 16 > VTableUses
The list of vtables that are required but have not yet been materialized.
Definition Sema.h:7387
void AddModeAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Name, bool InInstantiation=false)
AddModeAttr - Adds a mode attribute to a particular declaration.
TypoExpr * CorrectTypoDelayed(const DeclarationNameInfo &Typo, Sema::LookupNameKind LookupKind, Scope *S, CXXScopeSpec *SS, CorrectionCandidateCallback &CCC, TypoDiagnosticGenerator TDG, TypoRecoveryCallback TRC, CorrectTypoKind Mode, DeclContext *MemberContext=nullptr, bool EnteringContext=false, const ObjCObjectPointerType *OPT=nullptr)
Try to "correct" a typo in the source code by finding visible declarations whose names are similar to...
AccessResult CheckStructuredBindingMemberAccess(SourceLocation UseLoc, CXXRecordDecl *DecomposedClass, DeclAccessPair Field)
Checks implicit access to a member in a structured binding.
void LookupVisibleDecls(Scope *S, LookupNameKind Kind, VisibleDeclConsumer &Consumer, bool IncludeGlobalScope=true, bool LoadExternal=true)
StmtResult ActOnWhileStmt(SourceLocation WhileLoc, SourceLocation LParenLoc, ConditionResult Cond, SourceLocation RParenLoc, Stmt *Body)
QualType CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
SourceLocation CurInitSegLoc
Definition Sema.h:724
CastKind PrepareScalarCast(ExprResult &src, QualType destType)
Prepares for a scalar cast, performing all the necessary stages except the final cast and returning t...
QualType CheckVectorLogicalOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc)
void CheckObjCPropertyAttributes(Decl *PropertyPtrTy, SourceLocation Loc, unsigned &Attributes, bool propertyInPrimaryClass)
Ensure attributes are consistent with type.
void ActOnPragmaMSVtorDisp(PragmaMsStackAction Action, SourceLocation PragmaLoc, MSVtorDispMode Value)
Called on well formed #pragma vtordisp().
Definition SemaAttr.cpp:626
bool CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, TemplateSpecializationKind NewTSK, NamedDecl *PrevDecl, TemplateSpecializationKind PrevTSK, SourceLocation PrevPtOfInstantiation, bool &SuppressNew)
Diagnose cases where we have an explicit template specialization before/after an explicit template in...
void EnterTemplatedContext(Scope *S, DeclContext *DC)
Enter a template parameter scope, after it's been associated with a particular DeclContext.
OMPClause * ActOnOpenMPScheduleClause(OpenMPScheduleClauseModifier M1, OpenMPScheduleClauseModifier M2, OpenMPScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation M1Loc, SourceLocation M2Loc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'schedule' clause.
ReuseLambdaContextDecl_t
Definition Sema.h:5251
@ ReuseLambdaContextDecl
Definition Sema.h:5251
void ActOnBaseSpecifiers(Decl *ClassDecl, MutableArrayRef< CXXBaseSpecifier * > Bases)
ActOnBaseSpecifiers - Attach the given base specifiers to the class, after checking whether there are...
SemaDiagnosticBuilder CUDADiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition SemaCUDA.cpp:727
bool tryToFixVariablyModifiedVarType(TypeSourceInfo *&TInfo, QualType &T, SourceLocation Loc, unsigned FailedFoldDiagID)
Attempt to fold a variable-sized type to a constant-sized type, returning true if we were successful.
const FunctionProtoType * ResolveExceptionSpec(SourceLocation Loc, const FunctionProtoType *FPT)
ExprResult ActOnNoexceptSpec(Expr *NoexceptExpr, ExceptionSpecificationType &EST)
Check the given noexcept-specifier, convert its expression, and compute the appropriate ExceptionSpec...
Optional< sema::TemplateDeductionInfo * > isSFINAEContext() const
Determines whether we are currently in a context where template argument substitution failures are no...
void CodeCompleteObjCSelector(Scope *S, ArrayRef< IdentifierInfo * > SelIdents)
void AddOverloadCandidate(FunctionDecl *Function, DeclAccessPair FoundDecl, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversions=false, bool PartialOverloading=false, bool AllowExplicit=true, bool AllowExplicitConversion=false, ADLCallKind IsADLCandidate=ADLCallKind::NotADL, ConversionSequenceList EarlyConversions=None, OverloadCandidateParamOrder PO={})
AddOverloadCandidate - Adds the given function to the set of candidate functions, using the given fun...
NamedDecl * findLocallyScopedExternCDecl(DeclarationName Name)
Look for a locally scoped extern "C" declaration by the given name.
bool CheckRedeclarationModuleOwnership(NamedDecl *New, NamedDecl *Old)
We've determined that New is a redeclaration of Old.
void CheckCastAlign(Expr *Op, QualType T, SourceRange TRange)
CheckCastAlign - Implements -Wcast-align, which warns when a pointer cast increases the alignment req...
ASTConsumer & getASTConsumer() const
Definition Sema.h:1626
NonOdrUseReason getNonOdrUseReasonInCurrentContext(ValueDecl *D)
If D cannot be odr-used in the current expression evaluation context, return a reason explaining why.
bool checkNSReturnsRetainedReturnType(SourceLocation loc, QualType type)
void DefineDefaultedComparison(SourceLocation Loc, FunctionDecl *FD, DefaultedComparisonKind DCK)
bool isUnexpandedParameterPackPermitted()
Determine whether an unexpanded parameter pack might be permitted in this location.
bool isEquivalentInternalLinkageDeclaration(const NamedDecl *A, const NamedDecl *B)
Determine if A and B are equivalent internal linkage declarations from different modules,...
void diagnoseUnavailableAlignedAllocation(const FunctionDecl &FD, SourceLocation Loc)
Produce diagnostics if FD is an aligned allocation or deallocation function that is unavailable.
ExprResult BuildCXXConstructExpr(SourceLocation ConstructLoc, QualType DeclInitType, NamedDecl *FoundDecl, CXXConstructorDecl *Constructor, MultiExprArg Exprs, bool HadMultipleCandidates, bool IsListInitialization, bool IsStdInitListInitialization, bool RequiresZeroInit, unsigned ConstructKind, SourceRange ParenRange)
BuildCXXConstructExpr - Creates a complete call to a constructor, including handling of its default a...
bool CheckCUDACall(SourceLocation Loc, FunctionDecl *Callee)
Check whether we're allowed to call Callee from the current context.
Definition SemaCUDA.cpp:786
void MarkFunctionParmPackReferenced(FunctionParmPackExpr *E)
Perform reference-marking and odr-use handling for a FunctionParmPackExpr.
void * OpaqueParser
Definition Sema.h:918
LazyVector< VarDecl *, ExternalSemaSource, &ExternalSemaSource::ReadTentativeDefinitions, 2, 2 > TentativeDefinitionsType
Definition Sema.h:870
Preprocessor & PP
Definition Sema.h:408
QualType CheckAdditionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc, QualType *CompLHSTy=nullptr)
OMPClause * ActOnOpenMPHasDeviceAddrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'has_device_addr' clause.
VariadicCallType getVariadicCallType(FunctionDecl *FDecl, const FunctionProtoType *Proto, Expr *Fn)
bool SpecialMemberIsTrivial(CXXMethodDecl *MD, CXXSpecialMember CSM, TrivialABIHandling TAH=TAH_IgnoreTrivialABI, bool Diagnose=false)
Determine whether a defaulted or deleted special member function is trivial, as specified in C++11 [c...
bool CheckConstexprFunctionDefinition(const FunctionDecl *FD, CheckConstexprKind Kind)
void CodeCompleteObjCImplementationDecl(Scope *S)
ExprResult BuildCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr, bool IsExecConfig=false, bool AllowRecovery=false)
BuildCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult BuildSynthesizedThreeWayComparison(SourceLocation OpLoc, const UnresolvedSetImpl &Fns, Expr *LHS, Expr *RHS, FunctionDecl *DefaultedFn)
AccessResult CheckBaseClassAccess(SourceLocation AccessLoc, QualType Base, QualType Derived, const CXXBasePath &Path, unsigned DiagID, bool ForceCheck=false, bool ForceUnprivileged=false)
Checks access for a hierarchy conversion.
OMPClause * ActOnOpenMPAcqRelClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'acq_rel' clause.
StmtResult ActOnOpenMPParallelMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop simd' after parsing of the associated sta...
bool MSPragmaOptimizeIsOn
The "on" or "off" argument passed by #pragma optimize, that denotes whether the optimizations in the ...
Definition Sema.h:765
bool DeduceFunctionTypeFromReturnExpr(FunctionDecl *FD, SourceLocation ReturnLoc, Expr *&RetExpr, const AutoType *AT)
Deduce the return type for a function from a returned expression, per C++1y [dcl.spec....
void collectUnexpandedParameterPacks(TemplateArgument Arg, SmallVectorImpl< UnexpandedParameterPack > &Unexpanded)
Collect the set of unexpanded parameter packs within the given template argument.
void ActOnFinishedFunctionDefinitionInOpenMPDeclareVariantScope(Decl *D, SmallVectorImpl< FunctionDecl * > &Bases)
Register D as specialization of all base functions in Bases in the current omp begin/end declare vari...
bool DiagnoseUnexpandedParameterPack(SourceLocation Loc, TypeSourceInfo *T, UnexpandedParameterPackContext UPPC)
If the given type contains an unexpanded parameter pack, diagnose the error.
bool RequireNonAbstractType(SourceLocation Loc, QualType T, TypeDiagnoser &Diagnoser)
ExprResult checkPseudoObjectIncDec(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opcode, Expr *Op)
Check an increment or decrement of a pseudo-object expression.
threadSafety::BeforeSet * ThreadSafetyDeclCache
Definition Sema.h:9500
SmallVector< PragmaAttributeGroup, 2 > PragmaAttributeStack
Definition Sema.h:749
MinSizeAttr * mergeMinSizeAttr(Decl *D, const AttributeCommonInfo &CI)
void CodeCompleteObjCInstanceMessage(Scope *S, Expr *Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, ObjCInterfaceDecl *Super=nullptr)
ExprResult BuildExpressionFromIntegralTemplateArgument(const TemplateArgument &Arg, SourceLocation Loc)
Construct a new expression that refers to the given integral template argument with the given source-...
NamedDecl * getShadowedDeclaration(const TypedefNameDecl *D, const LookupResult &R)
Return the declaration shadowed by the given typedef D, or null if it doesn't shadow any declaration ...
void checkTypeSupport(QualType Ty, SourceLocation Loc, ValueDecl *D=nullptr)
Check if the type is allowed to be used for the current target.
Definition Sema.cpp:1883
AccessResult CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair FoundDecl)
Perform access-control checking on a previously-unresolved member access which has now been resolved ...
bool hasVisibleMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a visible declaration of D that is a member specialization declaration (as oppo...
void updateOutOfDateSelector(Selector Sel)
bool areMatrixTypesOfTheSameDimension(QualType srcTy, QualType destTy)
Are the two types matrix types and do they have the same dimensions i.e.
DeclGroupPtrTy ActOnOpenMPAllocateDirective(SourceLocation Loc, ArrayRef< Expr * > VarList, ArrayRef< OMPClause * > Clauses, DeclContext *Owner=nullptr)
Called on well-formed '#pragma omp allocate'.
void AddBuiltinOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddBuiltinOperatorCandidates - Add the appropriate built-in operator overloads to the candidate set (...
bool CheckFunctionConstraints(const FunctionDecl *FD, ConstraintSatisfaction &Satisfaction, SourceLocation UsageLoc=SourceLocation())
Check whether the given function decl's trailing requires clause is satisfied, if any.
ExprResult ActOnCXXBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnCXXBoolLiteral - Parse {true,false} literals.
void AtomicPropertySetterGetterRules(ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl)
AtomicPropertySetterGetterRules - This routine enforces the rule (via warning) when atomic property h...
ExprResult ImpCastExprToType(Expr *E, QualType Type, CastKind CK, ExprValueKind VK=VK_PRValue, const CXXCastPath *BasePath=nullptr, CheckedConversionKind CCK=CCK_ImplicitConversion)
ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.
Definition Sema.cpp:620
ObjCMethodDecl * NSNumberLiteralMethods[NSAPI::NumNSNumberLiteralMethods]
The Objective-C NSNumber methods used to create NSNumber literals.
Definition Sema.h:1179
void CheckExtraCXXDefaultArguments(Declarator &D)
CheckExtraCXXDefaultArguments - Check for any extra default arguments in the declarator,...
ExprResult BuildCXXTypeConstructExpr(TypeSourceInfo *Type, SourceLocation LParenLoc, MultiExprArg Exprs, SourceLocation RParenLoc, bool ListInitialization)
void CheckCompleteDecompositionDeclaration(DecompositionDecl *DD)
void CodeCompleteObjCPropertySetter(Scope *S)
bool hasCStrMethod(const Expr *E)
Check to see if a given expression could have '.c_str()' called on it.
llvm::DenseMap< CanonicalDeclPtr< FunctionDecl >, std::vector< PartialDiagnosticAt > > DeviceDeferredDiags
Diagnostics that are emitted only if we discover that the given function must be codegen'ed.
Definition Sema.h:12577
OMPClause * ActOnOpenMPSimdlenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'simdlen' clause.
ObjCSubscriptKind CheckSubscriptingKind(Expr *FromE)
CheckSubscriptingKind - This routine decide what type of indexing represented by "FromE" is being don...
void checkClassLevelDLLAttribute(CXXRecordDecl *Class)
Check class-level dllimport/dllexport attribute.
TypeResult ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, const CXXScopeSpec &SS, const IdentifierInfo &II, SourceLocation IdLoc)
Called when the parser has parsed a C++ typename specifier, e.g., "typename T::type".
const LangOptions & LangOpts
Definition Sema.h:407
StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body)
FinishObjCForCollectionStmt - Attach the body to a objective-C foreach statement.
void InstantiateClassMembers(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiates the definitions of all of the member of the given class, which is an instantiation of a ...
std::pair< ValueDecl *, SourceLocation > PendingImplicitInstantiation
An entity for which implicit template instantiation is required.
Definition Sema.h:9510
ObjCMethodDecl * LookupFactoryMethodInGlobalPool(Selector Sel, SourceRange R, bool receiverIdOrClass=false)
LookupFactoryMethodInGlobalPool - Returns the method and warns if there are multiple signatures.
Definition Sema.h:4833
void EmitRelatedResultTypeNoteForReturn(QualType destType)
Given that we had incompatible pointer types in a return statement, check whether we're in a method w...
void ActOnCXXExitDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
ActOnCXXExitDeclaratorScope - Called when a declarator that previously invoked ActOnCXXEnterDeclarato...
void SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation)
SetIvarInitializers - This routine builds initialization ASTs for the Objective-C implementation whos...
std::pair< Expr *, std::string > findFailedBooleanCondition(Expr *Cond)
Find the failed Boolean condition within a given Boolean constant expression, and describe it with a ...
bool FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, AllocationFunctionScope NewScope, AllocationFunctionScope DeleteScope, QualType AllocType, bool IsArray, bool &PassAlignment, MultiExprArg PlaceArgs, FunctionDecl *&OperatorNew, FunctionDecl *&OperatorDelete, bool Diagnose=true)
Finds the overloads of operator new and delete that are appropriate for the allocation.
TemplateDeductionResult
Describes the result of template argument deduction.
Definition Sema.h:8694
@ TDK_InvalidExplicitArguments
The explicitly-specified template arguments were not valid template arguments for the given template.
Definition Sema.h:8737
@ TDK_Invalid
The declaration was invalid; do nothing.
Definition Sema.h:8698
@ TDK_InstantiationDepth
Template argument deduction exceeded the maximum template instantiation depth (which has already been...
Definition Sema.h:8701
@ TDK_Success
Template argument deduction was successful.
Definition Sema.h:8696
@ TDK_MiscellaneousDeductionFailure
Deduction failed; that's all we know.
Definition Sema.h:8744
@ TDK_ConstraintsNotSatisfied
The deduced arguments did not satisfy the constraints associated with the template.
Definition Sema.h:8742
@ TDK_NonDependentConversionFailure
Checking non-dependent argument conversions failed.
Definition Sema.h:8739
@ TDK_TooFewArguments
When performing template argument deduction for a function template, there were too few call argument...
Definition Sema.h:8734
@ TDK_Incomplete
Template argument deduction did not deduce a value for every template parameter.
Definition Sema.h:8704
@ TDK_CUDATargetMismatch
CUDA Target attributes do not match.
Definition Sema.h:8746
@ TDK_DeducedMismatchNested
After substituting deduced template arguments, an element of a dependent parameter type did not match...
Definition Sema.h:8725
@ TDK_DeducedMismatch
After substituting deduced template arguments, a dependent parameter type did not match the correspon...
Definition Sema.h:8721
@ TDK_Inconsistent
Template argument deduction produced inconsistent deduced values for the given template parameter.
Definition Sema.h:8710
@ TDK_NonDeducedMismatch
A non-depnedent component of the parameter did not match the corresponding component of the argument.
Definition Sema.h:8728
@ TDK_TooManyArguments
When performing template argument deduction for a function template, there were too many call argumen...
Definition Sema.h:8731
@ TDK_IncompletePack
Template argument deduction did not deduce a value for every expansion of an expanded template parame...
Definition Sema.h:8707
@ TDK_Underqualified
Template argument deduction failed due to inconsistent cv-qualifiers on a template parameter type tha...
Definition Sema.h:8715
@ TDK_SubstitutionFailure
Substitution of the deduced template argument values resulted in an error.
Definition Sema.h:8718
void DiagnoseReturnInConstructorExceptionHandler(CXXTryStmt *TryBlock)
void MarkVirtualMembersReferenced(SourceLocation Loc, const CXXRecordDecl *RD, bool ConstexprOnly=false)
MarkVirtualMembersReferenced - Will mark all members of the given CXXRecordDecl referenced.
bool IsMemberPointerConversion(Expr *From, QualType FromType, QualType ToType, bool InOverloadResolution, QualType &ConvertedType)
IsMemberPointerConversion - Determines whether the conversion of the expression From,...
ExprResult ActOnGenericSelectionExpr(SourceLocation KeyLoc, SourceLocation DefaultLoc, SourceLocation RParenLoc, Expr *ControllingExpr, ArrayRef< ParsedType > ArgTypes, ArrayRef< Expr * > ArgExprs)
ExprResult BuildBuiltinOffsetOf(SourceLocation BuiltinLoc, TypeSourceInfo *TInfo, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
__builtin_offsetof(type, a.b[123][456].c)
std::unique_ptr< sema::FunctionScopeInfo > CachedFunctionScope
Definition Sema.h:792
ExprResult CorrectDelayedTyposInExpr(ExprResult ER, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Definition Sema.h:4449
sema::LambdaScopeInfo * getCurLambda(bool IgnoreNonLambdaCapturingScope=false)
Retrieve the current lambda scope info, if any.
Definition Sema.cpp:2303
ExprResult BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, SourceLocation LParenLoc, ArrayRef< Expr * > Arg, SourceLocation RParenLoc, Expr *Config=nullptr, bool IsExecConfig=false, ADLCallKind UsesADL=ADLCallKind::NotADL)
BuildResolvedCallExpr - Build a call to a resolved expression, i.e.
static const uint64_t MaximumAlignment
Definition Sema.h:398
void CodeCompleteFunctionQualifiers(DeclSpec &DS, Declarator &D, const VirtSpecifiers *VS=nullptr)
void AddInstanceMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddInstanceMethodToGlobalPool - All instance methods in a translation unit are added to a global pool...
Definition Sema.h:4810
NamedDecl * ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous, MultiTemplateParamsArg TemplateParamLists, bool &AddToScope, ArrayRef< BindingDecl * > Bindings=None)
ExprResult BuildCXXMemberCallExpr(Expr *Exp, NamedDecl *FoundDecl, CXXConversionDecl *Method, bool HadMultipleCandidates)
ExprResult CheckConditionVariable(VarDecl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
Check the use of the given variable as a C++ condition in an if, while, do-while, or switch statement...
ExprResult CheckForImmediateInvocation(ExprResult E, FunctionDecl *Decl)
Wrap the expression in a ConstantExpr if it is a potential immediate invocation.
SmallVector< Scope *, 2 > CurrentSEHFinally
Stack of active SEH __finally scopes. Can be empty.
Definition Sema.h:438
void ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, IdentifierInfo *ClassName, SmallVectorImpl< Decl * > &Decls)
Called whenever @defs(ClassName) is encountered in the source.
ExprResult TemporaryMaterializationConversion(Expr *E)
If E is a prvalue denoting an unmaterialized temporary, materialize it as an xvalue.
bool ShouldEnterDeclaratorScope(Scope *S, const CXXScopeSpec &SS)
void popObjCTypeParamList(Scope *S, ObjCTypeParamList *typeParamList)
SmallVector< std::pair< FunctionDecl *, FunctionDecl * >, 2 > DelayedEquivalentExceptionSpecChecks
All the function redeclarations seen during a class definition that had their exception spec checks d...
Definition Sema.h:906
void ActOnStartOfCompoundStmt(bool IsStmtExpr)
Definition SemaStmt.cpp:389
bool isReachable(const NamedDecl *D)
Determine whether a declaration is reachable.
Definition Sema.h:2323
void DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl)
DiagnoseTemplateParameterShadow - Produce a diagnostic complaining that the template parameter 'PrevD...
void PerformPendingInstantiations(bool LocalOnly=false)
Performs template instantiation for all implicit template instantiations we have seen until this poin...
Decl * ActOnStartOfFunctionDef(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists, SkipBodyInfo *SkipBody=nullptr, FnBodyKind BodyKind=FnBodyKind::Other)
NamedDeclSetType UnusedPrivateFields
Set containing all declared private fields that are not used.
Definition Sema.h:839
Expr * stripARCUnbridgedCast(Expr *e)
stripARCUnbridgedCast - Given an expression of ARCUnbridgedCast type, remove the placeholder cast.
OMPClause * ActOnOpenMPFilterClause(Expr *ThreadID, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'filter' clause.
ParmVarDecl * CheckParameter(DeclContext *DC, SourceLocation StartLoc, SourceLocation NameLoc, IdentifierInfo *Name, QualType T, TypeSourceInfo *TSInfo, StorageClass SC)
VarTemplateSpecializationDecl * CompleteVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VarSpec, VarDecl *PatternDecl, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiates a variable template specialization by completing it with appropriate type information an...
bool CollectStats
Flag indicating whether or not to collect detailed statistics.
Definition Sema.h:415
bool DiagnoseUnusedLambdaCapture(SourceRange CaptureRange, const sema::Capture &From)
Diagnose if an explicit lambda capture is unused.
void DefineInheritingConstructor(SourceLocation UseLoc, CXXConstructorDecl *Constructor)
Define the specified inheriting constructor.
void ActOnEndOfTranslationUnitFragment(TUFragmentKind Kind)
Definition Sema.cpp:1037
bool ShouldWarnIfUnusedFileScopedDecl(const DeclaratorDecl *D) const
bool CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, LookupResult &Previous, bool IsMemberSpecialization, bool DeclIsDefn)
Perform semantic checking of a new function declaration.
CXXRecordDecl * getStdBadAlloc() const
ExprResult ActOnCXXTypeConstructExpr(ParsedType TypeRep, SourceLocation LParenOrBraceLoc, MultiExprArg Exprs, SourceLocation RParenOrBraceLoc, bool ListInitialization)
ActOnCXXTypeConstructExpr - Parse construction of a specified type.
AlwaysInlineAttr * mergeAlwaysInlineAttr(Decl *D, const AttributeCommonInfo &CI, const IdentifierInfo *Ident)
FieldDecl * CheckFieldDecl(DeclarationName Name, QualType T, TypeSourceInfo *TInfo, RecordDecl *Record, SourceLocation Loc, bool Mutable, Expr *BitfieldWidth, InClassInitStyle InitStyle, SourceLocation TSSL, AccessSpecifier AS, NamedDecl *PrevDecl, Declarator *D=nullptr)
Build a new FieldDecl and check its well-formedness.
void CheckUnusedVolatileAssignment(Expr *E)
Check whether E, which is either a discarded-value expression or an unevaluated operand,...
ObjCLiteralKind
Definition Sema.h:3823
@ LK_Dictionary
Definition Sema.h:3825
@ LK_String
Definition Sema.h:3828
@ LK_Numeric
Definition Sema.h:3826
ExprResult BuildObjCEncodeExpression(SourceLocation AtLoc, TypeSourceInfo *EncodedTypeInfo, SourceLocation RParenLoc)
QualType CheckDestructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckDestructorDeclarator - Called by ActOnDeclarator to check the well-formednes of the destructor d...
OMPClause * ActOnOpenMPAffinityClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, Expr *Modifier, ArrayRef< Expr * > Locators)
Called on well-formed 'affinity' clause.
bool CheckPureMethod(CXXMethodDecl *Method, SourceRange InitRange)
Mark the given method pure.
void SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
bool FindDeallocationFunction(SourceLocation StartLoc, CXXRecordDecl *RD, DeclarationName Name, FunctionDecl *&Operator, bool Diagnose=true)
PragmaClangSection PragmaClangRelroSection
Definition Sema.h:473
void NoteHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
void InstantiateVariableInitializer(VarDecl *Var, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the initializer of a variable.
LazyVector< TypedefNameDecl *, ExternalSemaSource, &ExternalSemaSource::ReadExtVectorDecls, 2, 2 > ExtVectorDeclsType
Definition Sema.h:826
CXXMethodDecl * DeclareImplicitMoveAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit move assignment operator for the given class.
bool IsSimplyAccessible(NamedDecl *Decl, CXXRecordDecl *NamingClass, QualType BaseType)
Checks access to Target from the given class.
QualType CheckTypenameType(ElaboratedTypeKeyword Keyword, SourceLocation KeywordLoc, NestedNameSpecifierLoc QualifierLoc, const IdentifierInfo &II, SourceLocation IILoc, TypeSourceInfo **TSI, bool DeducedTSTContext)
SourceLocation ImplicitMSInheritanceAttrLoc
Source location for newly created implicit MSInheritanceAttrs.
Definition Sema.h:441
void DiagnoseNontrivial(const CXXRecordDecl *Record, CXXSpecialMember CSM)
Diagnose why the specified class does not have a trivial special member of the given kind.
llvm::DenseMap< CXXRecordDecl *, bool > VTablesUsed
The set of classes whose vtables have been used within this translation unit, and a bit that will be ...
Definition Sema.h:7393
OMPClause * ActOnOpenMPProcBindClause(llvm::omp::ProcBindKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'proc_bind' clause.
OMPThreadPrivateDecl * CheckOMPThreadPrivateDecl(SourceLocation Loc, ArrayRef< Expr * > VarList)
Builds a new OpenMPThreadPrivateDecl and checks its correctness.
void MaybeSuggestAddingStaticToDecl(const FunctionDecl *D)
Definition SemaExpr.cpp:198
bool TemplateParameterListsAreEqual(TemplateParameterList *New, TemplateParameterList *Old, bool Complain, TemplateParameterListEqualKind Kind, SourceLocation TemplateArgLoc=SourceLocation())
Determine whether the given template parameter lists are equivalent.
void CheckCXXDefaultArguments(FunctionDecl *FD)
CheckCXXDefaultArguments - Verify that the default arguments for a function declaration are well-form...
SmallVector< Decl *, 2 > WeakTopLevelDecl
WeakTopLevelDecl - Translation-unit scoped declarations generated by #pragma weak during processing o...
Definition Sema.h:1117
ComparisonCategoryUsage
Definition Sema.h:5961
@ OperatorInExpression
The '<=>' operator was used in an expression and a builtin operator was selected.
@ DefaultedOperator
A defaulted 'operator<=>' needed the comparison category.
SmallVector< PendingImplicitInstantiation, 1 > LateParsedInstantiations
Queue of implicit template instantiations that cannot be performed eagerly.
Definition Sema.h:9518
SmallVector< InventedTemplateParameterInfo, 4 > InventedParameterInfos
Stack containing information needed when in C++2a an 'auto' is encountered in a function declaration ...
Definition Sema.h:812
DeclarationNameInfo SubstDeclarationNameInfo(const DeclarationNameInfo &NameInfo, const MultiLevelTemplateArgumentList &TemplateArgs)
Do template substitution on declaration name info.
bool CanUseDecl(NamedDecl *D, bool TreatUnavailableAsInvalid)
Determine whether the use of this declaration is valid, without emitting diagnostics.
Definition SemaExpr.cpp:65
ConditionResult ActOnConditionVariable(Decl *ConditionVar, SourceLocation StmtLoc, ConditionKind CK)
bool isInOpenMPAssumeScope() const
Check if there is an active global omp begin assumes directive.
Definition Sema.h:10845
void startOpenMPCXXRangeFor()
If the current region is a range loop-based region, mark the start of the loop construct.
ObjCInterfaceDecl * NSNumberDecl
The declaration of the Objective-C NSNumber class.
Definition Sema.h:1167
bool checkUnsafeAssigns(SourceLocation Loc, QualType LHS, Expr *RHS)
checkUnsafeAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained type.
TemplateParameterList * SubstTemplateParams(TemplateParameterList *Params, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
void MarkAnyDeclReferenced(SourceLocation Loc, Decl *D, bool MightBeOdrUse)
Perform marking for a reference to an arbitrary declaration.
void ProcessDeclAttributeList(Scope *S, Decl *D, const ParsedAttributesView &AttrList, const ProcessDeclAttributeOptions &Options=ProcessDeclAttributeOptions())
ProcessDeclAttributeList - Apply all the decl attributes in the specified attribute list to the speci...
void MarkVTableUsed(SourceLocation Loc, CXXRecordDecl *Class, bool DefinitionRequired=false)
Note that the vtable for the given class was used at the given location.
void setOpenMPCaptureKind(FieldDecl *FD, const ValueDecl *D, unsigned Level)
Sets OpenMP capture kind (OMPC_private, OMPC_firstprivate, OMPC_map etc.) for FD based on DSA for the...
WebAssemblyImportModuleAttr * mergeImportModuleAttr(Decl *D, const WebAssemblyImportModuleAttr &AL)
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc, SourceRange R)
Checks that a type is suitable as the allocated type in a new-expression.
NamespaceDecl * lookupStdExperimentalNamespace()
QualType InvalidLogicalVectorOperands(SourceLocation Loc, ExprResult &LHS, ExprResult &RHS)
bool diagnoseArgIndependentDiagnoseIfAttrs(const NamedDecl *ND, SourceLocation Loc)
Emit diagnostics for the diagnose_if attributes on Function, ignoring any ArgDependent DiagnoseIfAttr...
static StringRef getPrintable(StringRef S)
Definition Sema.h:2146
OMPClause * ActOnOpenMPSeqCstClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'seq_cst' clause.
void MaybeAddCUDAConstantAttr(VarDecl *VD)
May add implicit CUDAConstantAttr attribute to VD, depending on VD and current compilation settings.
Definition SemaCUDA.cpp:713
void AddImplicitMSFunctionNoBuiltinAttr(FunctionDecl *FD)
Only called on function definitions; if there is a pragma in scope with the effect of a range-based n...
Optional< unsigned > getNumArgumentsInExpansion(QualType T, const MultiLevelTemplateArgumentList &TemplateArgs)
Determine the number of arguments in the given pack expansion type.
TypeLoc getReturnTypeLoc(FunctionDecl *FD) const
PragmaStack< AlignPackInfo > AlignPackStack
Definition Sema.h:680
StmtResult ActOnOpenMPMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp masked taskloop simd' after parsing of the associated statement.
ExprResult BuildInstanceMessageImplicit(Expr *Receiver, QualType ReceiverType, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
bool canDelayFunctionBody(const Declarator &D)
Determine whether we can delay parsing the body of a function or function template until it is used,...
static bool GetFormatNSStringIdx(const FormatAttr *Format, unsigned &Idx)
CleanupInfo Cleanup
Used to control the generation of ExprWithCleanups.
Definition Sema.h:777
std::vector< std::unique_ptr< TemplateInstantiationCallback > > TemplateInstCallbacks
The template instantiation callbacks to trace or track instantiations (objects can be chained).
Definition Sema.h:9159
llvm::DenseMap< ParmVarDecl *, SourceLocation > UnparsedDefaultArgLocs
Definition Sema.h:1453
void CodeCompleteNamespaceDecl(Scope *S)
StmtResult ActOnExprStmtError()
Definition SemaStmt.cpp:63
OMPClause * ActOnOpenMPAlignClause(Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'align' clause.
PragmaStack< StringLiteral * > BSSSegStack
Definition Sema.h:690
ExprResult BuildTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< TypeSourceInfo * > Args, SourceLocation RParenLoc)
ObjCInterfaceDecl * ActOnStartClassInterface(Scope *S, SourceLocation AtInterfaceLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, ObjCTypeParamList *typeParamList, IdentifierInfo *SuperName, SourceLocation SuperLoc, ArrayRef< ParsedType > SuperTypeArgs, SourceRange SuperTypeArgsRange, Decl *const *ProtoRefs, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
const VarDecl * getCopyElisionCandidate(NamedReturnInfo &Info, QualType ReturnType)
Updates given NamedReturnInfo's move-eligible and copy-elidable statuses, considering the function re...
void CodeCompleteDesignator(const QualType BaseType, llvm::ArrayRef< Expr * > InitExprs, const Designation &D)
Trigger code completion for a record of BaseType.
void MarkVirtualMemberExceptionSpecsNeeded(SourceLocation Loc, const CXXRecordDecl *RD)
Mark the exception specifications of all virtual member functions in the given class as needed.
bool CheckParamExceptionSpec(const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const FunctionProtoType *Target, SourceLocation TargetLoc, const FunctionProtoType *Source, SourceLocation SourceLoc)
CheckParamExceptionSpec - Check if the parameter and return types of the two functions have equivalen...
StmtResult ActOnOpenMPForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp for simd' after parsing of the associated statement.
const ObjCMethodDecl * SelectorsForTypoCorrection(Selector Sel, QualType ObjectType=QualType())
bool hasAnyAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true, bool AllowNonTemplateFunctions=false)
void completeExprArrayBound(Expr *E)
DeclContext * getCurLexicalContext() const
Definition Sema.h:13376
llvm::StringMap< std::tuple< StringRef, SourceLocation > > FunctionToSectionMap
Sections used with #pragma alloc_text.
Definition Sema.h:727
bool ActOnSuperScopeSpecifier(SourceLocation SuperLoc, SourceLocation ColonColonLoc, CXXScopeSpec &SS)
The parser has parsed a '__super' nested-name-specifier.
llvm::DenseMap< ParmVarDecl *, llvm::TinyPtrVector< ParmVarDecl * > > UnparsedDefaultArgInstantiationsMap
Definition Sema.h:1440
QualType getElaboratedType(ElaboratedTypeKeyword Keyword, const CXXScopeSpec &SS, QualType T, TagDecl *OwnedTagDecl=nullptr)
Retrieve a version of the type 'T' that is elaborated by Keyword, qualified by the nested-name-specif...
bool RequireCompleteEnumDecl(EnumDecl *D, SourceLocation L, CXXScopeSpec *SS=nullptr)
Require that the EnumDecl is completed with its enumerators defined or instantiated.
bool CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl)
CheckOverloadedOperatorDeclaration - Check whether the declaration of this overloaded operator is wel...
void AddAllocAlignAttr(Decl *D, const AttributeCommonInfo &CI, Expr *ParamExpr)
AddAllocAlignAttr - Adds an alloc_align attribute to a particular declaration.
bool hasExplicitCallingConv(QualType T)
NameClassification ClassifyName(Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc, const Token &NextToken, CorrectionCandidateCallback *CCC=nullptr)
Perform name lookup on the given name, classifying it based on the results of name lookup and the fol...
Definition SemaDecl.cpp:862
OpaquePtr< QualType > TypeTy
Definition Sema.h:402
void PrintInstantiationStack()
Prints the current instantiation stack through a series of notes.
QualType NSStringPointer
Pointer to NSString type (NSString *).
Definition Sema.h:1185
StmtResult ActOnNullStmt(SourceLocation SemiLoc, bool HasLeadingEmptyMacro=false)
Definition SemaStmt.cpp:68
OpenCLOptions OpenCLFeatures
Definition Sema.h:404
QualType FindCompositePointerType(SourceLocation Loc, Expr *&E1, Expr *&E2, bool ConvertArgs=true)
Find a merged pointer type and convert the two expressions to it.
OMPClause * ActOnOpenMPNumTeamsClause(Expr *NumTeams, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_teams' clause.
ExprResult BuildUnresolvedCoawaitExpr(SourceLocation KwLoc, Expr *Operand, UnresolvedLookupExpr *Lookup)
Decl * ActOnConceptDefinition(Scope *S, MultiTemplateParamsArg TemplateParameterLists, IdentifierInfo *Name, SourceLocation NameLoc, Expr *ConstraintExpr)
VarArgKind isValidVarArgType(const QualType &Ty)
Determine the degree of POD-ness for an expression.
Definition SemaExpr.cpp:918
NonTagKind getNonTagTypeDeclKind(const Decl *D, TagTypeKind TTK)
Given a non-tag type declaration, returns an enum useful for indicating what kind of non-tag type thi...
Optional< unsigned > getFullyPackExpandedSize(TemplateArgument Arg)
Given a template argument that contains an unexpanded parameter pack, but which has already been subs...
llvm::SmallSetVector< StringRef, 4 > MSFunctionNoBuiltins
Set of no-builtin functions listed by #pragma function.
Definition Sema.h:768
ExprResult BuildExpressionTrait(ExpressionTrait OET, SourceLocation KWLoc, Expr *Queried, SourceLocation RParen)
void ExitDeclaratorContext(Scope *S)
bool isQualifiedMemberAccess(Expr *E)
Determine whether the given expression is a qualified member access expression, of a form that could ...
bool isInOpenMPDeclareTargetContext() const
Return true inside OpenMP declare target region.
Definition Sema.h:10943
void deepTypeCheckForSYCLDevice(SourceLocation UsedAt, llvm::DenseSet< QualType > Visited, ValueDecl *DeclToCheck)
Definition SemaSYCL.cpp:58
bool CheckRegparmAttr(const ParsedAttr &attr, unsigned &value)
Checks a regparm attribute, returning true if it is ill-formed and otherwise setting numParams to the...
void DiagnoseShadowingLambdaDecls(const sema::LambdaScopeInfo *LSI)
Diagnose shadowing for variables shadowed in the lambda record LambdaRD when these variables are capt...
bool LookupParsedName(LookupResult &R, Scope *S, CXXScopeSpec *SS, bool AllowBuiltinCreation=false, bool EnteringContext=false)
Performs name lookup for a name that was parsed in the source code, and may contain a C++ scope speci...
void ActOnOpenMPDeclareTargetName(NamedDecl *ND, SourceLocation Loc, OMPDeclareTargetDeclAttr::MapTypeTy MT, DeclareTargetContextInfo &DTCI)
Called on correct id-expression from the '#pragma omp declare target'.
static CastKind ScalarTypeToBooleanCastKind(QualType ScalarTy)
ScalarTypeToBooleanCastKind - Returns the cast kind corresponding to the conversion from scalar type ...
Definition Sema.cpp:701
void CodeCompleteNaturalLanguage()
void PushUsingDirective(Scope *S, UsingDirectiveDecl *UDir)
void CodeCompleteOperatorName(Scope *S)
RecordDecl * CreateCapturedStmtRecordDecl(CapturedDecl *&CD, SourceLocation Loc, unsigned NumParams)
bool isLibstdcxxEagerExceptionSpecHack(const Declarator &D)
Determine if we're in a case where we need to (incorrectly) eagerly parse an exception specification ...
void CheckConstructor(CXXConstructorDecl *Constructor)
CheckConstructor - Checks a fully-formed constructor for well-formedness, issuing any diagnostics req...
void DefineImplicitLambdaToBlockPointerConversion(SourceLocation CurrentLoc, CXXConversionDecl *Conv)
Define the "body" of the conversion from a lambda object to a block pointer.
void AddCFAuditedAttribute(Decl *D)
AddCFAuditedAttribute - Check whether we're currently within '#pragma clang arc_cf_code_audited' and,...
Definition SemaAttr.cpp:857
bool buildCoroutineParameterMoves(SourceLocation Loc)
void DefineImplicitDestructor(SourceLocation CurrentLocation, CXXDestructorDecl *Destructor)
DefineImplicitDestructor - Checks for feasibility of defining this destructor as the default destruct...
OMPClause * ActOnOpenMPDefaultClause(llvm::omp::DefaultKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'default' clause.
ExprResult BuildCStyleCastExpr(SourceLocation LParenLoc, TypeSourceInfo *Ty, SourceLocation RParenLoc, Expr *Op)
bool hasGlobalOpenMPAssumes() const
Check if there is an active global omp assumes directive.
Definition Sema.h:10848
void DiagnoseUnusedButSetDecl(const VarDecl *VD)
If VD is set but not otherwise used, diagnose, for a parameter or a variable.
DeclGroupPtrTy ActOnGlobalModuleFragmentDecl(SourceLocation ModuleLoc)
The parser has processed a global-module-fragment declaration that begins the definition of the globa...
void ActOnCapturedRegionStart(SourceLocation Loc, Scope *CurScope, CapturedRegionKind Kind, unsigned NumParams)
bool CheckTollFreeBridgeStaticCast(QualType castType, Expr *castExpr, CastKind &Kind)
void CheckMSVCRTEntryPoint(FunctionDecl *FD)
FileNullabilityMap NullabilityMap
A mapping that describes the nullability we've seen in each header file.
Definition Sema.h:720
OMPClause * ActOnOpenMPNocontextClause(Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nocontext' clause.
void AddAnnotationAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Annot, MutableArrayRef< Expr * > Args)
AddAnnotationAttr - Adds an annotation Annot with Args arguments to D.
StmtResult ActOnOpenMPMasterTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop simd' after parsing of the associated statement.
void CodeCompleteObjCProtocolReferences(ArrayRef< IdentifierLocPair > Protocols)
void DiagnoseMisalignedMembers()
Diagnoses the current set of gathered accesses.
ObjCMessageKind getObjCMessageKind(Scope *S, IdentifierInfo *Name, SourceLocation NameLoc, bool IsSuper, bool HasTrailingDot, ParsedType &ReceiverType)
CXXRecordDecl * getCurrentClass(Scope *S, const CXXScopeSpec *SS)
Get the class that is directly named by the current context.
ExprResult BuildCXXUuidof(QualType TypeInfoType, SourceLocation TypeidLoc, TypeSourceInfo *Operand, SourceLocation RParenLoc)
Build a Microsoft __uuidof expression with a type operand.
Decl * ActOnEnumConstant(Scope *S, Decl *EnumDecl, Decl *LastEnumConstant, SourceLocation IdLoc, IdentifierInfo *Id, const ParsedAttributesView &Attrs, SourceLocation EqualLoc, Expr *Val)
sema::FunctionScopeInfo * getCurFunction() const
Definition Sema.h:1950
OMPClause * ActOnOpenMPAlignedClause(ArrayRef< Expr * > VarList, Expr *Alignment, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'aligned' clause.
ExprResult ActOnUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Op, Expr *Input)
StmtResult ActOnOpenMPTargetTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute parallel for' after parsing of the associa...
void checkUnsafeExprAssigns(SourceLocation Loc, Expr *LHS, Expr *RHS)
checkUnsafeExprAssigns - Check whether +1 expr is being assigned to weak/__unsafe_unretained expressi...
void PushCompoundScope(bool IsStmtExpr)
Definition Sema.cpp:2222
bool usesPartialOrExplicitSpecialization(SourceLocation Loc, ClassTemplateSpecializationDecl *ClassTemplateSpec)
ProcessingContextState ParsingClassState
Definition Sema.h:5204
QualType BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Expr *ArraySize, unsigned Quals, SourceRange Brackets, DeclarationName Entity)
Build an array type.
StmtResult ActOnOpenMPParallelSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel sections' after parsing of the associated statement.
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef< Decl * > Group)
BuildDeclaratorGroup - convert a list of declarations into a declaration group, performing any necess...
FunctionDecl * CreateBuiltin(IdentifierInfo *II, QualType Type, unsigned ID, SourceLocation Loc)
ExprResult ActOnClassMessage(Scope *S, ParsedType Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
Scope * getNonFieldDeclScope(Scope *S)
getNonFieldDeclScope - Retrieves the innermost scope, starting from S, where a non-field would be dec...
StmtResult ActOnOpenMPTargetEnterDataDirective(ArrayRef< OMPClause * > Clauses, SourceLocation StartLoc, SourceLocation EndLoc, Stmt *AStmt)
Called on well-formed '#pragma omp target enter data' after parsing of the associated statement.
void handleLambdaNumbering(CXXRecordDecl *Class, CXXMethodDecl *Method, Optional< std::tuple< bool, unsigned, unsigned, Decl * > > Mangling=None)
Number lambda for linkage purposes if necessary.
ExprResult LookupInObjCMethod(LookupResult &LookUp, Scope *S, IdentifierInfo *II, bool AllowBuiltinCreation=false)
The parser has read a name in, and Sema has detected that we're currently inside an ObjC method.
Expr * BuildCXXThisExpr(SourceLocation Loc, QualType Type, bool IsImplicit)
Build a CXXThisExpr and mark it referenced in the current context.
void pushCodeSynthesisContext(CodeSynthesisContext Ctx)
OMPClause * ActOnOpenMPIfClause(OpenMPDirectiveKind NameModifier, Expr *Condition, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation NameModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc)
Called on well-formed 'if' clause.
QualType BuildReferenceType(QualType T, bool LValueRef, SourceLocation Loc, DeclarationName Entity)
Build a reference type.
bool mightBeIntendedToBeTemplateName(ExprResult E, bool &Dependent)
Determine whether it's plausible that E was intended to be a template-name.
Definition Sema.h:2774
ParmVarDecl * SubstParmVarDecl(ParmVarDecl *D, const MultiLevelTemplateArgumentList &TemplateArgs, int indexAdjustment, Optional< unsigned > NumExpansions, bool ExpectParameterPack)
void ActOnPragmaWeakID(IdentifierInfo *WeakName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc)
ActOnPragmaWeakID - Called on well formed #pragma weak ident.
QualType CheckSizelessVectorOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, ArithConvKind OperationKind)
bool CheckNontrivialField(FieldDecl *FD)
CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller, const FunctionDecl *Callee)
Identifies relative preference of a given Caller/Callee combination, based on their host/device attri...
Definition SemaCUDA.cpp:207
ExprResult ActOnOpenMPCall(ExprResult Call, Scope *Scope, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig)
Given the potential call expression Call, determine if there is a specialization via the OpenMP decla...
StmtResult ActOnOpenMPTargetTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute' after parsing of the associated statement...
bool DiagnoseUseOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass=nullptr, bool ObjCPropertyAccess=false, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReciever=nullptr)
Determine whether the use of this declaration is valid, and emit any corresponding diagnostics.
Definition SemaExpr.cpp:221
void CodeCompleteObjCAtVisibility(Scope *S)
void ProcessDeclAttributeDelayed(Decl *D, const ParsedAttributesView &AttrList)
HLSLNumThreadsAttr * mergeHLSLNumThreadsAttr(Decl *D, const AttributeCommonInfo &AL, int X, int Y, int Z)
TemplateArgumentLoc getTrivialTemplateArgumentLoc(const TemplateArgument &Arg, QualType NTTPType, SourceLocation Loc)
Allocate a TemplateArgumentLoc where all locations have been initialized to the given location.
bool NeedToCaptureVariable(VarDecl *Var, SourceLocation Loc)
Checks if the variable must be captured.
AssignConvertType CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose=true, bool DiagnoseCFAudited=false, bool ConvertRHS=true)
Check assignment constraints for an assignment of RHS to LHSType.
void DiagnoseAssignmentEnum(QualType DstType, QualType SrcType, Expr *SrcExpr)
DiagnoseAssignmentEnum - Warn if assignment to enum is a constant integer not in the range of enum va...
llvm::DenseMap< const VarDecl *, int > RefsMinusAssignments
Increment when we find a reference; decrement when we find an ignored assignment.
Definition Sema.h:1589
ExprResult ActOnFinishTrailingRequiresClause(ExprResult ConstraintExpr)
void AddPushedVisibilityAttribute(Decl *RD)
AddPushedVisibilityAttribute - If '#pragma GCC visibility' was used, add an appropriate visibility at...
bool checkThisInStaticMemberFunctionAttributes(CXXMethodDecl *Method)
Check whether 'this' shows up in the attributes of the given static member function.
CXXRecordDecl * getCurrentInstantiationOf(NestedNameSpecifier *NNS)
If the given nested name specifier refers to the current instantiation, return the declaration that c...
ExprResult PerformQualificationConversion(Expr *E, QualType Ty, ExprValueKind VK=VK_PRValue, CheckedConversionKind CCK=CCK_ImplicitConversion)
void CodeCompleteNamespaceAliasDecl(Scope *S)
void ActOnStartCXXMemberDeclarations(Scope *S, Decl *TagDecl, SourceLocation FinalLoc, bool IsFinalSpelledSealed, bool IsAbstract, SourceLocation LBraceLoc)
ActOnStartCXXMemberDeclarations - Invoked when we have parsed a C++ record definition's base-specifie...
ExprResult CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, const UnresolvedSetImpl &Fns, Expr *input, bool RequiresADL=true)
Create a unary operation that may resolve to an overloaded operator.
void ActOnParamDefaultArgumentError(Decl *param, SourceLocation EqualLoc)
ActOnParamDefaultArgumentError - Parsing or semantic analysis of the default argument for the paramet...
void DiagnosePropertyMismatch(ObjCPropertyDecl *Property, ObjCPropertyDecl *SuperProperty, const IdentifierInfo *Name, bool OverridingProtocolProperty)
DiagnosePropertyMismatch - Compares two properties for their attributes and types and warns on a vari...
ExprResult ActOnCoawaitExpr(Scope *S, SourceLocation KwLoc, Expr *E)
OMPClause * ActOnOpenMPUsesAllocatorClause(SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, ArrayRef< UsesAllocatorsData > Data)
Called on well-formed 'uses_allocators' clause.
void MarkCaptureUsedInEnclosingContext(VarDecl *Capture, SourceLocation Loc, unsigned CapturingScopeIndex)
CXXBaseSpecifier * CheckBaseSpecifier(CXXRecordDecl *Class, SourceRange SpecifierRange, bool Virtual, AccessSpecifier Access, TypeSourceInfo *TInfo, SourceLocation EllipsisLoc)
ActOnBaseSpecifier - Parsed a base specifier.
VarDecl * BuildExceptionDeclaration(Scope *S, TypeSourceInfo *TInfo, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id)
Perform semantic analysis for the variable declaration that occurs within a C++ catch clause,...
std::function< ExprResult(Sema &, TypoExpr *, TypoCorrection)> TypoRecoveryCallback
Definition Sema.h:4271
bool findMacroSpelling(SourceLocation &loc, StringRef name)
Looks through the macro-expansion chain for the given location, looking for a macro expansion with th...
Definition Sema.cpp:2027
DeclResult CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, TemplateParameterList *TemplateParams, AccessSpecifier AS, SourceLocation ModulePrivateLoc, SourceLocation FriendLoc, unsigned NumOuterTemplateParamLists, TemplateParameterList **OuterTemplateParamLists, SkipBodyInfo *SkipBody=nullptr)
ExprResult ActOnMemberAccessExpr(Scope *S, Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, UnqualifiedId &Member, Decl *ObjCImpDecl)
The main callback when the parser finds something like expression .
OMPClause * ActOnOpenMPOrderedClause(SourceLocation StartLoc, SourceLocation EndLoc, SourceLocation LParenLoc=SourceLocation(), Expr *NumForLoops=nullptr)
Called on well-formed 'ordered' clause.
ExprResult BuildImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, bool IsDefiniteInstance, const Scope *S)
Builds an implicit member access expression.
UnparsedDefaultArgInstantiationsMap UnparsedDefaultArgInstantiations
A mapping from parameters with unparsed default arguments to the set of instantiations of each parame...
Definition Sema.h:1449
QualType DeduceTemplateSpecializationFromInitializer(TypeSourceInfo *TInfo, const InitializedEntity &Entity, const InitializationKind &Kind, MultiExprArg Init)
void DefineImplicitDefaultConstructor(SourceLocation CurrentLocation, CXXConstructorDecl *Constructor)
DefineImplicitDefaultConstructor - Checks for feasibility of defining this constructor as the default...
bool SubstParmTypes(SourceLocation Loc, ArrayRef< ParmVarDecl * > Params, const FunctionProtoType::ExtParameterInfo *ExtParamInfos, const MultiLevelTemplateArgumentList &TemplateArgs, SmallVectorImpl< QualType > &ParamTypes, SmallVectorImpl< ParmVarDecl * > *OutParams, ExtParameterInfoBuilder &ParamInfos)
Substitute the given template arguments into the given set of parameters, producing the set of parame...
void DiagnoseEmptyStmtBody(SourceLocation StmtLoc, const Stmt *Body, unsigned DiagID)
Emit DiagID if statement located on StmtLoc has a suspicious null statement as a Body,...
bool hasMergedDefinitionInCurrentModule(NamedDecl *Def)
void AddOverloadedCallCandidates(UnresolvedLookupExpr *ULE, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool PartialOverloading=false)
Add the overload candidates named by callee and/or found by argument dependent lookup to the given ov...
StmtResult ActOnOpenMPParallelMaskedTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel masked taskloop simd' after parsing of the associated sta...
StmtResult ActOnOpenMPTaskDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp task' after parsing of the associated statement.
ExprResult VerifyBitField(SourceLocation FieldLoc, IdentifierInfo *FieldName, QualType FieldTy, bool IsMsStruct, Expr *BitWidth)
VerifyBitField - verifies that a bit field expression is an ICE and has the correct width,...
bool CheckVariableDeclaration(VarDecl *NewVD, LookupResult &Previous)
Perform semantic checking on a newly-created variable declaration.
SmallVector< CXXRecordDecl *, 4 > DelayedDllExportClasses
Definition Sema.h:13407
NamespaceDecl * StdExperimentalNamespaceCache
The C++ "std::experimental" namespace, where the experimental parts of the standard library resides.
Definition Sema.h:1139
void MarkThisReferenced(CXXThisExpr *This)
bool MaybeEmitAmbiguousAtomicConstraintsDiagnostic(NamedDecl *D1, ArrayRef< const Expr * > AC1, NamedDecl *D2, ArrayRef< const Expr * > AC2)
If D1 was not at least as constrained as D2, but would've been if a pair of atomic constraints involv...
void DiagnoseEmptyLoopBody(const Stmt *S, const Stmt *PossibleBody)
Warn if a for/while loop statement S, which is followed by PossibleBody, has a suspicious null statem...
ExprResult DefaultLvalueConversion(Expr *E)
Definition SemaExpr.cpp:626
int ArgumentPackSubstitutionIndex
The current index into pack expansion arguments that will be used for substitution of parameter packs...
Definition Sema.h:9167
MSInheritanceAttr * mergeMSInheritanceAttr(Decl *D, const AttributeCommonInfo &CI, bool BestCase, MSInheritanceModel Model)
void diagnoseMissingImport(SourceLocation Loc, NamedDecl *Decl, MissingImportKind MIK, bool Recover=true)
Diagnose that the specified declaration needs to be visible but isn't, and suggest a module import th...
bool CheckUsingShadowDecl(BaseUsingDecl *BUD, NamedDecl *Target, const LookupResult &PreviousDecls, UsingShadowDecl *&PrevShadow)
Determines whether to create a using shadow decl for a particular decl, given the set of decls existi...
ExprResult BuildDeclarationNameExpr(const CXXScopeSpec &SS, LookupResult &R, bool NeedsADL, bool AcceptInvalidDecl=false)
SourceLocation getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const
bool isVisible(const NamedDecl *D)
Determine whether a declaration is visible to name lookup.
Definition Sema.h:2317
ExprResult BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S)
bool CheckDerivedToBaseConversion(QualType Derived, QualType Base, SourceLocation Loc, SourceRange Range, CXXCastPath *BasePath=nullptr, bool IgnoreAccess=false)
StringLiteral * CurInitSeg
Last section used with #pragma init_seg.
Definition Sema.h:723
Module * getCurrentModule() const
Get the module unit whose scope we are currently within.
Definition Sema.h:2286
Decl * ActOnMethodDeclaration(Scope *S, SourceLocation BeginLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, ArrayRef< SourceLocation > SelectorLocs, Selector Sel, ObjCArgInfo *ArgInfo, DeclaratorChunk::ParamInfo *CParamInfo, unsigned CNumArgs, const ParsedAttributesView &AttrList, tok::ObjCKeywordKind MethodImplKind, bool isVariadic, bool MethodDefinition)
bool AddOverriddenMethods(CXXRecordDecl *DC, CXXMethodDecl *MD)
AddOverriddenMethods - See if a method overrides any in the base classes, and if so,...
InternalLinkageAttr * mergeInternalLinkageAttr(Decl *D, const ParsedAttr &AL)
Selector RespondsToSelectorSel
will hold 'respondsToSelector:'
Definition Sema.h:1209
void CodeCompleteAttribute(AttributeCommonInfo::Syntax Syntax, AttributeCompletion Completion=AttributeCompletion::Attribute, const IdentifierInfo *Scope=nullptr)
void maybeExtendBlockObject(ExprResult &E)
Do an explicit extend of the given block pointer if we're in ARC.
StmtResult ActOnOpenMPUnrollDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp unroll' after parsing of its clauses and the associated statement.
static bool isCast(CheckedConversionKind CCK)
Definition Sema.h:11844
void ActOnBlockError(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockError - If there is an error parsing a block, this callback is invoked to pop the informati...
QualType ActOnOpenMPDeclareReductionType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare reduction' construct.
ExprResult prepareVectorSplat(QualType VectorTy, Expr *SplattedExpr)
Prepare SplattedExpr for a vector splat operation, adding implicit casts if necessary.
void CodeCompleteIncludedFile(llvm::StringRef Dir, bool IsAngled)
void CheckForFunctionRedefinition(FunctionDecl *FD, const FunctionDecl *EffectiveDefinition=nullptr, SkipBodyInfo *SkipBody=nullptr)
bool hasReachableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if the template parameter D has a reachable default argument.
OMPClause * ActOnOpenMPMergeableClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'mergeable' clause.
sema::BlockScopeInfo * getCurBlock()
Retrieve the current block, if any.
Definition Sema.cpp:2260
bool DiagnoseMultipleUserDefinedConversion(Expr *From, QualType ToType)
IfExistsResult CheckMicrosoftIfExistsSymbol(Scope *S, CXXScopeSpec &SS, const DeclarationNameInfo &TargetNameInfo)
void ArgumentDependentLookup(DeclarationName Name, SourceLocation Loc, ArrayRef< Expr * > Args, ADLResult &Functions)
std::unique_ptr< RecordDeclSetTy > PureVirtualClassDiagSet
PureVirtualClassDiagSet - a set of class declarations which we have emitted a list of pure virtual fu...
Definition Sema.h:859
void DiagnoseAutoDeductionFailure(VarDecl *VDecl, Expr *Init)
bool IvarBacksCurrentMethodAccessor(ObjCInterfaceDecl *IFace, ObjCMethodDecl *Method, ObjCIvarDecl *IV)
IvarBacksCurrentMethodAccessor - This routine returns 'true' if 'IV' is an ivar synthesized for 'Meth...
bool ActOnDuplicateDefinition(Decl *Prev, SkipBodyInfo &SkipBody)
Perform ODR-like check for C/ObjC when merging tag types from modules.
void ActOnFinishInlineFunctionDef(FunctionDecl *D)
FunctionDecl * resolveAddressOfSingleOverloadCandidate(Expr *E, DeclAccessPair &FoundResult)
Given an expression that refers to an overloaded function, try to resolve that function to a single f...
DeclContext * CurContext
CurContext - This is the current declaration context of parsing.
Definition Sema.h:421
RedeclarationKind
Specifies whether (or how) name lookup is being performed for a redeclaration (vs.
Definition Sema.h:4215
@ NotForRedeclaration
The lookup is a reference to this name that is not for the purpose of redeclaring the name.
Definition Sema.h:4218
@ ForVisibleRedeclaration
The lookup results will be used for redeclaration of a name, if an entity by that name already exists...
Definition Sema.h:4221
@ ForExternalRedeclaration
The lookup results will be used for redeclaration of a name with external linkage; non-visible lookup...
Definition Sema.h:4225
void ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope)
Initialization of captured region for OpenMP region.
llvm::PointerIntPair< CXXRecordDecl *, 3, CXXSpecialMember > SpecialMemberDecl
Definition Sema.h:1519
MaterializeTemporaryExpr * CreateMaterializeTemporaryExpr(QualType T, Expr *Temporary, bool BoundToLvalueReference)
bool CollectMultipleMethodsInGlobalPool(Selector Sel, SmallVectorImpl< ObjCMethodDecl * > &Methods, bool InstanceFirst, bool CheckTheOther, const ObjCObjectType *TypeBound=nullptr)
We first select the type of the method: Instance or Factory, then collect all methods with that type.
ExprResult ParseObjCStringLiteral(SourceLocation *AtLocs, ArrayRef< Expr * > Strings)
bool CheckOpenMPLinearDecl(const ValueDecl *D, SourceLocation ELoc, OpenMPLinearClauseKind LinKind, QualType Type, bool IsDeclareSimd=false)
Checks that the specified declaration matches requirements for the linear decls.
ExprResult checkUnknownAnyCast(SourceRange TypeRange, QualType CastType, Expr *CastExpr, CastKind &CastKind, ExprValueKind &VK, CXXCastPath &Path)
Check a cast of an unknown-any type.
StmtResult ActOnOpenMPDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp distribute' after parsing of the associated statement.
void CodeCompleteObjCSuperclass(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ExprResult ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, SourceLocation LAngleBracketLoc, Declarator &D, SourceLocation RAngleBracketLoc, SourceLocation LParenLoc, Expr *E, SourceLocation RParenLoc)
ActOnCXXNamedCast - Parse {dynamic,static,reinterpret,const,addrspace}_cast's.
Definition SemaCast.cpp:273
FriendDecl * CheckFriendTypeDecl(SourceLocation LocStart, SourceLocation FriendLoc, TypeSourceInfo *TSInfo)
Perform semantic analysis of the given friend type declaration.
DeclGroupPtrTy ActOnPrivateModuleFragmentDecl(SourceLocation ModuleLoc, SourceLocation PrivateLoc)
The parser has processed a private-module-fragment declaration that begins the definition of the priv...
DeclResult actOnObjCTypeParam(Scope *S, ObjCTypeParamVariance variance, SourceLocation varianceLoc, unsigned index, IdentifierInfo *paramName, SourceLocation paramLoc, SourceLocation colonLoc, ParsedType typeBound)
void ActOnDocumentableDecl(Decl *D)
Should be called on all declarations that might have attached documentation comments.
VarDecl * ActOnOpenMPDeclareReductionInitializerStart(Scope *S, Decl *D)
Initialize declare reduction construct initializer.
SuppressedDiagnosticsMap SuppressedDiagnostics
Definition Sema.h:9197
bool IsOverload(FunctionDecl *New, FunctionDecl *Old, bool IsForUsingDecl, bool ConsiderCudaAttrs=true, bool ConsiderRequiresClauses=true)
@ VAK_Invalid
Definition Sema.h:11920
@ VAK_ValidInCXX11
Definition Sema.h:11917
@ VAK_MSVCUndefined
Definition Sema.h:11919
@ VAK_Undefined
Definition Sema.h:11918
void ActOnFinishedFunctionDefinitionInOpenMPAssumeScope(Decl *D)
Act on D, a function definition inside of an omp [begin/end] assumes.
void ActOnPragmaMSFunction(SourceLocation Loc, const llvm::SmallVectorImpl< StringRef > &NoBuiltins)
Call on well formed #pragma function.
DeclarationNameInfo GetNameFromUnqualifiedId(const UnqualifiedId &Name)
Retrieves the declaration name from a parsed unqualified-id.
std::deque< PendingImplicitInstantiation > PendingLocalImplicitInstantiations
The queue of implicit template instantiations that are required and must be performed within the curr...
Definition Sema.h:9573
TypeSourceInfo * RebuildTypeInCurrentInstantiation(TypeSourceInfo *T, SourceLocation Loc, DeclarationName Name)
Rebuilds a type within the context of the current instantiation.
void ActOnPragmaMSStruct(PragmaMSStructKind Kind)
ActOnPragmaMSStruct - Called on well formed #pragma ms_struct [on|off].
Definition SemaAttr.cpp:501
ExprResult ActOnGNUNullExpr(SourceLocation TokenLoc)
bool AreMultipleMethodsInGlobalPool(Selector Sel, ObjCMethodDecl *BestMethod, SourceRange R, bool receiverIdOrClass, SmallVectorImpl< ObjCMethodDecl * > &Methods)
StmtResult ActOnOpenMPBarrierDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp barrier'.
void CompleteMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
bool isPreciseFPEnabled()
Are precise floating point semantics currently enabled?
Definition Sema.h:10340
bool tryCaptureVariable(VarDecl *Var, SourceLocation Loc, TryCaptureKind Kind, SourceLocation EllipsisLoc, bool BuildAndDiagnose, QualType &CaptureType, QualType &DeclRefType, const unsigned *const FunctionScopeIndexToStopAt)
Try to capture the given variable.
IdentifierInfo * getNullabilityKeyword(NullabilityKind nullability)
Retrieve the keyword associated.
StmtResult ActOnOpenMPMasterDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp master' after parsing of the associated statement.
ExprResult PerformContextuallyConvertToBool(Expr *From)
PerformContextuallyConvertToBool - Perform a contextual conversion of the expression From to bool (C+...
void maybeAddCUDAHostDeviceAttrs(FunctionDecl *FD, const LookupResult &Previous)
May add implicit CUDAHostAttr and CUDADeviceAttr attributes to FD, depending on FD and the current co...
Definition SemaCUDA.cpp:661
void DefineImplicitCopyAssignment(SourceLocation CurrentLocation, CXXMethodDecl *MethodDecl)
Defines an implicitly-declared copy assignment operator.
void ActOnPragmaMSInitSeg(SourceLocation PragmaLocation, StringLiteral *SegmentName)
Called on well-formed #pragma init_seg().
Definition SemaAttr.cpp:783
AccessResult CheckConstructorAccess(SourceLocation Loc, CXXConstructorDecl *D, DeclAccessPair FoundDecl, const InitializedEntity &Entity, bool IsCopyBindingRefToTemp=false)
Checks access to a constructor.
static SourceRange getPrintable(TypeLoc TL)
Definition Sema.h:2156
StmtResult ActOnOpenMPTaskgroupDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskgroup'.
bool DiagnoseDependentMemberLookup(LookupResult &R)
Diagnose a lookup that found results in an enclosing class during error recovery.
bool SetDelegatingInitializer(CXXConstructorDecl *Constructor, CXXCtorInitializer *Initializer)
RecordDecl * MSVCGuidDecl
The MSVC "_GUID" struct, which is defined in MSVC header files.
Definition Sema.h:1157
QualType QIDNSCopying
id<NSCopying> type.
Definition Sema.h:1206
ParsedType getDestructorTypeForDecltype(const DeclSpec &DS, ParsedType ObjectType)
TrivialABIHandling
Definition Sema.h:3292
@ TAH_IgnoreTrivialABI
The triviality of a method unaffected by "trivial_abi".
Definition Sema.h:3294
@ TAH_ConsiderTrivialABI
The triviality of a method affected by "trivial_abi".
Definition Sema.h:3297
FormatArgumentPassingKind
Definition Sema.h:13025
@ FAPK_Variadic
Definition Sema.h:13027
@ FAPK_VAList
Definition Sema.h:13028
void FillInlineAsmIdentifierInfo(Expr *Res, llvm::InlineAsmIdentifierInfo &Info)
CXXMethodDecl * LookupMovingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the moving assignment operator for the given class.
void MarkDeclarationsReferencedInType(SourceLocation Loc, QualType T)
Mark all of the declarations referenced within a particular AST node as referenced.
bool BuildCXXNestedNameSpecifier(Scope *S, NestedNameSpecInfo &IdInfo, bool EnteringContext, CXXScopeSpec &SS, NamedDecl *ScopeLookupResult, bool ErrorRecoveryLookup, bool *IsCorrectedToColon=nullptr, bool OnlyNamespace=false)
Build a new nested-name-specifier for "identifier::", as described by ActOnCXXNestedNameSpecifier.
bool isUnevaluatedContext() const
Determines whether we are currently in a context that is not evaluated as per C++ [expr] p5.
Definition Sema.h:9408
StmtResult ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, NamedReturnInfo &NRInfo, bool SupressSimplerImplicitMoves)
ActOnCapScopeReturnStmt - Utility routine to type-check return statements for capturing scopes.
MethodMatchStrategy
Definition Sema.h:4722
@ MMS_strict
Definition Sema.h:4724
@ MMS_loose
Definition Sema.h:4723
void PushForceCUDAHostDevice()
Increments our count of the number of times we've seen a pragma forcing functions to be host device.
Definition SemaCUDA.cpp:37
Stmt * MaybeCreateStmtWithCleanups(Stmt *SubStmt)
FunctionDecl * InstantiateFunctionDeclaration(FunctionTemplateDecl *FTD, const TemplateArgumentList *Args, SourceLocation Loc)
Instantiate (or find existing instantiation of) a function template with a given set of template argu...
AccessResult CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair FoundDecl)
OMPClause * ActOnOpenMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'release' clause.
bool CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl)
CheckLiteralOperatorDeclaration - Check whether the declaration of this literal operator function is ...
SmallVector< LateInstantiatedAttribute, 16 > LateInstantiatedAttrVec
Definition Sema.h:9738
bool DefineUsedVTables()
Define all of the vtables that have been used in this translation unit and reference any virtual memb...
llvm::SmallVector< TypoExpr *, 2 > TypoExprs
Holds TypoExprs that are created from createDelayedTypo.
Definition Sema.h:447
AssignConvertType
AssignConvertType - All of the 'assignment' semantic checks return this enum to indicate whether the ...
Definition Sema.h:11987
@ IncompatiblePointerDiscardsQualifiers
IncompatiblePointerDiscardsQualifiers - The assignment discards qualifiers that we don't permit to be...
Definition Sema.h:12025
@ IntToPointer
IntToPointer - The assignment converts an int to a pointer, which we accept as an extension.
Definition Sema.h:11997
@ IncompatibleBlockPointer
IncompatibleBlockPointer - The assignment is between two block pointers types that are not compatible...
Definition Sema.h:12049
@ IncompatibleObjCQualifiedId
IncompatibleObjCQualifiedId - The assignment is between a qualified id type and something else (that ...
Definition Sema.h:12054
@ IncompatibleVectors
IncompatibleVectors - The assignment is between two vector types that have the same size,...
Definition Sema.h:12041
@ CompatiblePointerDiscardsQualifiers
CompatiblePointerDiscardsQualifiers - The assignment discards c/v/r qualifiers, which we accept as an...
Definition Sema.h:12020
@ IncompatiblePointer
IncompatiblePointer - The assignment is between two pointers types that are not compatible,...
Definition Sema.h:12005
@ IncompatibleObjCWeakRef
IncompatibleObjCWeakRef - Assigning a weak-unavailable object to an object with __weak qualifier.
Definition Sema.h:12058
@ Compatible
Compatible - the types are compatible according to the standard.
Definition Sema.h:11989
@ Incompatible
Incompatible - We reject this conversion outright, it is invalid to represent it in the AST.
Definition Sema.h:12062
@ FunctionVoidPointer
FunctionVoidPointer - The assignment is between a function pointer and void*, which the standard does...
Definition Sema.h:12001
@ IncompatibleFunctionPointer
IncompatibleFunctionPointer - The assignment is between two function pointers types that are not comp...
Definition Sema.h:12010
@ IncompatiblePointerSign
IncompatiblePointerSign - The assignment is between two pointers types which point to integers which ...
Definition Sema.h:12016
@ IncompatibleNestedPointerQualifiers
IncompatibleNestedPointerQualifiers - The assignment is between two nested pointer types,...
Definition Sema.h:12037
@ IncompatibleNestedPointerAddressSpaceMismatch
IncompatibleNestedPointerAddressSpaceMismatch - The assignment changes address spaces in nested point...
Definition Sema.h:12031
@ PointerToInt
PointerToInt - The assignment converts a pointer to an int, which we accept as an extension.
Definition Sema.h:11993
@ IntToBlockPointer
IntToBlockPointer - The assignment converts an int to a block pointer.
Definition Sema.h:12045
CXXMethodDecl * DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl)
Declare the implicit copy assignment operator for the given class.
QualType ProduceCtorInitMemberSignatureHelp(Decl *ConstructorDecl, CXXScopeSpec SS, ParsedType TemplateTypeTy, ArrayRef< Expr * > ArgExprs, IdentifierInfo *II, SourceLocation OpenParLoc, bool Braced)
ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal, SourceLocation PlacementLParen, MultiExprArg PlacementArgs, SourceLocation PlacementRParen, SourceRange TypeIdParens, Declarator &D, Expr *Initializer)
ActOnCXXNew - Parsed a C++ 'new' expression.
void MarkVirtualBaseDestructorsReferenced(SourceLocation Location, CXXRecordDecl *ClassDecl, llvm::SmallPtrSetImpl< const RecordType * > *DirectVirtualBases=nullptr)
Mark destructors of virtual bases of this class referenced.
CXXConstructorDecl * LookupMovingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the moving constructor for the given class.
ParserCompletionContext
Describes the context in which code completion occurs.
Definition Sema.h:12827
@ PCC_RecoveryInFunction
Code completion occurs within the body of a function on a recovery path, where we do not have a speci...
Definition Sema.h:12861
@ PCC_LocalDeclarationSpecifiers
Code completion occurs within a sequence of declaration specifiers within a function,...
Definition Sema.h:12869
@ PCC_Template
Code completion occurs following one or more template headers.
Definition Sema.h:12843
@ PCC_MemberTemplate
Code completion occurs following one or more template headers within a class.
Definition Sema.h:12846
@ PCC_Expression
Code completion occurs within an expression.
Definition Sema.h:12848
@ PCC_ObjCInterface
Code completion occurs within an Objective-C interface, protocol, or category.
Definition Sema.h:12834
@ PCC_Class
Code completion occurs within a class, struct, or union.
Definition Sema.h:12831
@ PCC_ObjCImplementation
Code completion occurs within an Objective-C implementation or category implementation.
Definition Sema.h:12837
@ PCC_ParenthesizedExpression
Code completion occurs in a parenthesized expression, which might also be a type cast.
Definition Sema.h:12866
@ PCC_Namespace
Code completion occurs at top-level or namespace context.
Definition Sema.h:12829
@ PCC_Type
Code completion occurs where only a type is permitted.
Definition Sema.h:12863
@ PCC_Condition
Code completion occurs within the condition of an if, while, switch, or for statement.
Definition Sema.h:12857
@ PCC_ForInit
Code completion occurs at the beginning of the initialization statement (or expression) in a for loop...
Definition Sema.h:12854
@ PCC_Statement
Code completion occurs within a statement, which may also be an expression or a declaration.
Definition Sema.h:12851
@ PCC_ObjCInstanceVariableList
Code completion occurs within the list of instance variables in an Objective-C interface,...
Definition Sema.h:12840
void checkIllFormedTrivialABIStruct(CXXRecordDecl &RD)
Check that the C++ class annoated with "trivial_abi" satisfies all the conditions that are needed for...
OMPClause * ActOnOpenMPCopyinClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyin' clause.
void CheckShadowingDeclModification(Expr *E, SourceLocation Loc)
Warn if 'E', which is an expression that is about to be modified, refers to a shadowing declaration.
SkipBodyInfo shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II, SourceLocation IILoc)
Determine whether the body of an anonymous enumeration should be skipped.
ObjCProtocolDecl * LookupProtocol(IdentifierInfo *II, SourceLocation IdLoc, RedeclarationKind Redecl=NotForRedeclaration)
Find the protocol with the given name, if any.
TemplateNameKindForDiagnostics getTemplateNameKindForDiagnostics(TemplateName Name)
VarDecl * BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType ExceptionType, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, bool Invalid=false)
Build a type-check a new Objective-C exception variable declaration.
StmtResult ActOnCapturedRegionEnd(Stmt *S)
ArithConvKind
Context in which we're performing a usual arithmetic conversion.
Definition Sema.h:11961
@ ACK_Arithmetic
An arithmetic operation.
Definition Sema.h:11963
@ ACK_CompAssign
A compound assignment expression.
Definition Sema.h:11971
@ ACK_BitwiseOp
A bitwise operation.
Definition Sema.h:11965
@ ACK_Conditional
A conditional (?:) operator.
Definition Sema.h:11969
@ ACK_Comparison
A comparison.
Definition Sema.h:11967
StmtResult ActOnOpenMPTargetTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams distribute simd' after parsing of the associated stat...
void notePreviousDefinition(const NamedDecl *Old, SourceLocation New)
void MarkDeclRefReferenced(DeclRefExpr *E, const Expr *Base=nullptr)
Perform reference-marking and odr-use handling for a DeclRefExpr.
StmtResult ActOnOpenMPCriticalDirective(const DeclarationNameInfo &DirName, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp critical' after parsing of the associated statement.
ExprResult BuildCXXNoexceptExpr(SourceLocation KeyLoc, Expr *Operand, SourceLocation RParen)
bool isAcceptable(const NamedDecl *D, AcceptableKind Kind)
Determine whether a declaration is acceptable (visible/reachable).
Definition Sema.h:2330
ObjCMethodDecl * LookupImplementedMethodInGlobalPool(Selector Sel)
LookupImplementedMethodInGlobalPool - Returns the method which has an implementation.
void RestoreNestedNameSpecifierAnnotation(void *Annotation, SourceRange AnnotationRange, CXXScopeSpec &SS)
Given an annotation pointer for a nested-name-specifier, restore the nested-name-specifier structure.
QualType getDecltypeForExpr(Expr *E)
getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the ru...
NamedDecl * DeclClonePragmaWeak(NamedDecl *ND, const IdentifierInfo *II, SourceLocation Loc)
DeclClonePragmaWeak - clone existing decl (maybe definition), #pragma weak needs a non-definition dec...
ObjCContainerDecl * getObjCDeclContext() const
DLLExportAttr * mergeDLLExportAttr(Decl *D, const AttributeCommonInfo &CI)
StmtResult ActOnOpenMPParallelMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel masked' after parsing of the associated statement.
CXXMethodDecl * LookupCopyingAssignment(CXXRecordDecl *Class, unsigned Quals, bool RValueThis, unsigned ThisQuals)
Look up the copying assignment operator for the given class.
bool isInOpenMPDeclareVariantScope() const
Can we exit an OpenMP declare variant scope at the moment.
Definition Sema.h:10708
OMPClause * ActOnOpenMPDistScheduleClause(OpenMPDistScheduleClauseKind Kind, Expr *ChunkSize, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation KindLoc, SourceLocation CommaLoc, SourceLocation EndLoc)
Called on well-formed 'dist_schedule' clause.
StmtResult ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, ConditionResult Second, FullExprArg Third, SourceLocation RParenLoc, Stmt *Body)
bool isKnownName(StringRef name)
StmtResult ActOnIndirectGotoStmt(SourceLocation GotoLoc, SourceLocation StarLoc, Expr *DestExp)
bool GlobalNewDeleteDeclared
A flag to remember whether the implicit forms of operator new and delete have been declared.
Definition Sema.h:1213
TemplateNameKind ActOnTemplateName(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const UnqualifiedId &Name, ParsedType ObjectType, bool EnteringContext, TemplateTy &Template, bool AllowInjectedClassName=false)
Form a template name from a name that is syntactically required to name a template,...
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, const PartialDiagnostic &PD, FunctionDecl *FD=nullptr)
Definition Sema.h:12662
ExprResult ActOnParenExpr(SourceLocation L, SourceLocation R, Expr *E)
DeclContext * OriginalLexicalContext
Generally null except when we temporarily switch decl contexts, like in.
Definition Sema.h:425
void ActOnOpenMPDeclareReductionInitializerEnd(Decl *D, Expr *Initializer, VarDecl *OmpPrivParm)
Finish current declare reduction construct initializer.
llvm::PointerIntPair< ConstantExpr *, 1 > ImmediateInvocationCandidate
Definition Sema.h:1267
bool MSStructPragmaOn
Definition Sema.h:431
ExprResult CheckPlaceholderExpr(Expr *E)
Check for operands with placeholder types and complain if found.
bool hasVisibleDefinition(NamedDecl *D, NamedDecl **Suggested, bool OnlyNeedComplete=false)
Determine if D has a visible definition.
ExprResult TransformToPotentiallyEvaluated(Expr *E)
CodeSegAttr * mergeCodeSegAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
unsigned ActOnReenterTemplateScope(Decl *Template, llvm::function_ref< Scope *()> EnterScope)
EnableIfAttr * CheckEnableIf(FunctionDecl *Function, SourceLocation CallLoc, ArrayRef< Expr * > Args, bool MissingImplicitThis=false)
Check the enable_if expressions on the given function.
SectionAttr * mergeSectionAttr(Decl *D, const AttributeCommonInfo &CI, StringRef Name)
StmtResult ActOnOpenMPMaskedDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp masked' after parsing of the.
unsigned NonInstantiationEntries
The number of CodeSynthesisContexts that are not template instantiations and, therefore,...
Definition Sema.h:9143
OMPClause * ActOnOpenMPUseClause(Expr *InteropVar, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation VarLoc, SourceLocation EndLoc)
Called on well-formed 'use' clause.
CheckedConversionKind
The kind of conversion being performed.
Definition Sema.h:11831
@ CCK_OtherCast
A cast other than a C-style cast.
Definition Sema.h:11839
@ CCK_ForBuiltinOverloadedOp
A conversion for an operand of a builtin overloaded operator.
Definition Sema.h:11841
@ CCK_CStyleCast
A C-style cast.
Definition Sema.h:11835
@ CCK_ImplicitConversion
An implicit conversion.
Definition Sema.h:11833
@ CCK_FunctionalCast
A functional-style cast.
Definition Sema.h:11837
GlobalMethodPool MethodPool
Method Pool - allows efficient lookup when typechecking messages to "id".
Definition Sema.h:1496
bool canSkipFunctionBody(Decl *D)
Determine whether we can skip parsing the body of a function definition, assuming we don't care about...
bool canFullyTypeCheckRedeclaration(ValueDecl *NewD, ValueDecl *OldD, QualType NewT, QualType OldT)
Determines if we can perform a correct type check for D as a redeclaration of PrevDecl.
OMPClause * ActOnOpenMPFullClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-form 'full' clauses.
ExprResult CreateUnresolvedLookupExpr(CXXRecordDecl *NamingClass, NestedNameSpecifierLoc NNSLoc, DeclarationNameInfo DNI, const UnresolvedSetImpl &Fns, bool PerformADL=true)
bool inTemplateInstantiation() const
Determine whether we are currently performing template instantiation.
Definition Sema.h:9379
NonTagKind
Common ways to introduce type names without a tag for use in diagnostics.
Definition Sema.h:3210
@ NTK_Typedef
Definition Sema.h:3215
@ NTK_NonUnion
Definition Sema.h:3213
@ NTK_TypeAlias
Definition Sema.h:3216
@ NTK_NonClass
Definition Sema.h:3212
@ NTK_NonEnum
Definition Sema.h:3214
@ NTK_NonStruct
Definition Sema.h:3211
@ NTK_TemplateTemplateArgument
Definition Sema.h:3219
@ NTK_TypeAliasTemplate
Definition Sema.h:3218
@ NTK_Template
Definition Sema.h:3217
bool RequireCompleteType(SourceLocation Loc, QualType T, unsigned DiagID)
Definition Sema.h:2441
void ActOnObjCContainerFinishDefinition()
void ActOnOpenMPEndDeclareVariant()
Handle a omp end declare variant.
SourceManager & getSourceManager() const
Definition Sema.h:1623
void BuildModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
@ TryCapture_Implicit
Definition Sema.h:5295
@ TryCapture_ExplicitByVal
Definition Sema.h:5295
@ TryCapture_ExplicitByRef
Definition Sema.h:5295
StmtResult ActOnOpenMPTeamsDistributeDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute' after parsing of the associated statement.
bool isCFError(RecordDecl *D)
QualType CXXThisTypeOverride
When non-NULL, the C++ 'this' expression is allowed despite the current context not being a non-stati...
Definition Sema.h:6482
AssignmentAction
Definition Sema.h:3605
@ AA_Returning
Definition Sema.h:3608
@ AA_Passing_CFAudited
Definition Sema.h:3613
@ AA_Initializing
Definition Sema.h:3610
@ AA_Converting
Definition Sema.h:3609
@ AA_Assigning
Definition Sema.h:3606
@ AA_Passing
Definition Sema.h:3607
@ AA_Casting
Definition Sema.h:3612
@ AA_Sending
Definition Sema.h:3611
FunctionDecl * SubstSpaceshipAsEqualEqual(CXXRecordDecl *RD, FunctionDecl *Spaceship)
Substitute the name and return type of a defaulted 'operator<=>' to form an implicit 'operator=='.
CallingConventionIgnoredReason
Describes the reason a calling convention specification was ignored, used for diagnostics.
Definition Sema.h:13488
NamedDecl * ActOnDecompositionDeclarator(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParamLists)
Decl * ActOnAtEnd(Scope *S, SourceRange AtEnd, ArrayRef< Decl * > allMethods=None, ArrayRef< DeclGroupPtrTy > allTUVars=None)
ExprResult BuildAsTypeExpr(Expr *E, QualType DestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
Create a new AsTypeExpr node (bitcast) from the arguments.
QualType buildLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions, IdentifierInfo *Id, bool DirectInit, Expr *&Init)
ExprResult checkPseudoObjectRValue(Expr *E)
bool CheckVecStepExpr(Expr *E)
bool isNonTypeNestedNameSpecifier(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo)
bool makeUnavailableInSystemHeader(SourceLocation loc, UnavailableAttr::ImplicitReason reason)
makeUnavailableInSystemHeader - There is an error in the current context.
Definition Sema.cpp:515
bool isModuleVisible(const Module *M, bool ModulePrivate=false)
Decl * ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, MultiTemplateParamsArg TemplateParams)
Handle a friend type declaration.
void AddMethodCandidate(DeclAccessPair FoundDecl, QualType ObjectType, Expr::Classification ObjectClassification, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, bool SuppressUserConversion=false, OverloadCandidateParamOrder PO={})
AddMethodCandidate - Adds a named decl (which is some kind of method) as a method candidate to the gi...
std::pair< CXXRecordDecl *, SourceLocation > VTableUse
The list of classes whose vtables have been used within this translation unit, and the source locatio...
Definition Sema.h:7383
bool checkTargetAttr(SourceLocation LiteralLoc, StringRef Str)
ExprResult BuildFieldReferenceExpr(Expr *BaseExpr, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, FieldDecl *Field, DeclAccessPair FoundDecl, const DeclarationNameInfo &MemberNameInfo)
void diagnoseExprIntendedAsTemplateName(Scope *S, ExprResult TemplateName, SourceLocation Less, SourceLocation Greater)
llvm::DenseSet< FunctionDeclAndLoc > LocsWithCUDACallDiags
FunctionDecls and SourceLocations for which CheckCUDACall has emitted a (maybe deferred) "bad call" d...
Definition Sema.h:12589
void CodeCompleteBracketDeclarator(Scope *S)
void DiagnoseMissingDesignatedInitOverrides(const ObjCImplementationDecl *ImplD, const ObjCInterfaceDecl *IFD)
ExprResult BuildUnaryOp(Scope *S, SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *Input)
bool MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old, Scope *S, bool MergeTypeWithOld)
Completes the merge of two function declarations that are known to be compatible.
void getUndefinedButUsed(SmallVectorImpl< std::pair< NamedDecl *, SourceLocation > > &Undefined)
Obtain a sorted list of functions that are undefined but ODR-used.
Definition Sema.cpp:798
void ActOnEnumBody(SourceLocation EnumLoc, SourceRange BraceRange, Decl *EnumDecl, ArrayRef< Decl * > Elements, Scope *S, const ParsedAttributesView &Attr)
void DeclareImplicitDeductionGuides(TemplateDecl *Template, SourceLocation Loc)
Declare implicit deduction guides for a class template if we've not already done so.
void diagnoseEquivalentInternalLinkageDeclarations(SourceLocation Loc, const NamedDecl *D, ArrayRef< const NamedDecl * > Equiv)
void EnterDeclaratorContext(Scope *S, DeclContext *DC)
EnterDeclaratorContext - Used when we must lookup names in the context of a declarator's nested name ...
StmtResult ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope)
void diagnoseARCUnbridgedCast(Expr *e)
Given that we saw an expression with the ARCUnbridgedCastTy placeholder type, complain bitterly.
OMPClause * ActOnOpenMPCompareClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'compare' clause.
bool areMultiversionVariantFunctionsCompatible(const FunctionDecl *OldFD, const FunctionDecl *NewFD, const PartialDiagnostic &NoProtoDiagID, const PartialDiagnosticAt &NoteCausedDiagIDAt, const PartialDiagnosticAt &NoSupportDiagIDAt, const PartialDiagnosticAt &DiffDiagIDAt, bool TemplatesSupported, bool ConstexprSupported, bool CLinkageMayDiffer)
Checks if the variant/multiversion functions are compatible.
ExprResult PerformMoveOrCopyInitialization(const InitializedEntity &Entity, const NamedReturnInfo &NRInfo, Expr *Value, bool SupressSimplerImplicitMoves=false)
Perform the initialization of a potentially-movable value, which is the result of return value.
OMPClause * ActOnOpenMPDetachClause(Expr *Evt, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'detach' clause.
bool CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *MD, DefaultedComparisonKind DCK)
void DiagnoseClassExtensionDupMethods(ObjCCategoryDecl *CAT, ObjCInterfaceDecl *ID)
DiagnoseClassExtensionDupMethods - Check for duplicate declaration of a class method in its extension...
ObjCInterfaceDecl * NSArrayDecl
The declaration of the Objective-C NSArray class.
Definition Sema.h:1194
FunctionDecl * ResolveSingleFunctionTemplateSpecialization(OverloadExpr *ovl, bool Complain=false, DeclAccessPair *Found=nullptr)
Given an expression that refers to an overloaded function, try to resolve that overloaded function ex...
bool checkThisInStaticMemberFunctionExceptionSpec(CXXMethodDecl *Method)
Whether this' shows up in the exception specification of a static member function.
ExprResult ActOnConditionalOp(SourceLocation QuestionLoc, SourceLocation ColonLoc, Expr *CondExpr, Expr *LHSExpr, Expr *RHSExpr)
ActOnConditionalOp - Parse a ?: operation.
bool CheckTemplateTemplateArgument(TemplateTemplateParmDecl *Param, TemplateParameterList *Params, TemplateArgumentLoc &Arg)
Check a template argument against its corresponding template template parameter.
QualType CheckVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
CheckVectorCompareOperands - vector comparisons are a clang extension that operates on extended vecto...
ExprResult ActOnDependentMemberExpr(Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierInScope, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
QualType CheckMultiplyDivideOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign, bool IsDivide)
ExprResult CheckCXXBooleanCondition(Expr *CondExpr, bool IsConstexpr=false)
CheckCXXBooleanCondition - Returns true if conversion to bool is invalid.
DeclResult CheckVarTemplateId(VarTemplateDecl *Template, SourceLocation TemplateLoc, SourceLocation TemplateNameLoc, const TemplateArgumentListInfo &TemplateArgs)
Get the specialization of the given variable template corresponding to the specified argument list,...
llvm::FoldingSet< SpecialMemberOverloadResultEntry > SpecialMemberCache
A cache of special member function overload resolution results for C++ records.
Definition Sema.h:1419
ExprResult CheckLValueToRValueConversionOperand(Expr *E)
QualType CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, SourceLocation Loc, QualType CompoundType, BinaryOperatorKind Opc)
void DiagnoseNonDefaultPragmaAlignPack(PragmaAlignPackDiagnoseKind Kind, SourceLocation IncludeLoc)
Definition SemaAttr.cpp:435
Decl * ActOnStartLinkageSpecification(Scope *S, SourceLocation ExternLoc, Expr *LangStr, SourceLocation LBraceLoc)
ActOnStartLinkageSpecification - Parsed the beginning of a C++ linkage specification,...
TypeSourceInfo * SubstFunctionDeclType(TypeSourceInfo *T, const MultiLevelTemplateArgumentList &TemplateArgs, SourceLocation Loc, DeclarationName Entity, CXXRecordDecl *ThisContext, Qualifiers ThisTypeQuals)
A form of SubstType intended specifically for instantiating the type of a FunctionDecl.
void ActOnTagStartDefinition(Scope *S, Decl *TagDecl)
ActOnTagStartDefinition - Invoked when we have entered the scope of a tag's definition (e....
void FilterUsingLookup(Scope *S, LookupResult &lookup)
Remove decls we can't actually see from a lookup being used to declare shadow using decls.
ExprResult ActOnSYCLUniqueStableNameExpr(SourceLocation OpLoc, SourceLocation LParen, SourceLocation RParen, ParsedType ParsedTy)
CanThrowResult canThrow(const Stmt *E)
Decl * SubstDecl(Decl *D, DeclContext *Owner, const MultiLevelTemplateArgumentList &TemplateArgs)
bool isThisOutsideMemberFunctionBody(QualType BaseType)
Determine whether the given type is the type of *this that is used outside of the body of a member fu...
bool ResolveAndFixSingleFunctionTemplateSpecialization(ExprResult &SrcExpr, bool DoFunctionPointerConverion=false, bool Complain=false, SourceRange OpRangeForComplaining=SourceRange(), QualType DestTypeForComplaining=QualType(), unsigned DiagIDForComplaining=0)
void ActOnModuleInclude(SourceLocation DirectiveLoc, Module *Mod)
The parser has processed a module import translated from a #include or similar preprocessing directiv...
StmtResult ActOnOpenMPTargetParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel loop' after parsing of the associated statement.
bool AccessCheckingSFINAE
When true, access checking violations are treated as SFINAE failures rather than hard errors.
Definition Sema.h:7681
void actOnDelayedExceptionSpecification(Decl *Method, ExceptionSpecificationType EST, SourceRange SpecificationRange, ArrayRef< ParsedType > DynamicExceptions, ArrayRef< SourceRange > DynamicExceptionRanges, Expr *NoexceptExpr)
Add an exception-specification to the given member function (or member function template).
Decl * ActOnExceptionDeclarator(Scope *S, Declarator &D)
ActOnExceptionDeclarator - Parsed the exception-declarator in a C++ catch handler.
void DiscardMisalignedMemberAddress(const Type *T, Expr *E)
This function checks if the expression is in the sef of potentially misaligned members and it is conv...
StmtResult ActOnOpenMPExecutableDirective(OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName, OpenMPDirectiveKind CancelRegion, ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
ExprResult BuildCXXFoldExpr(UnresolvedLookupExpr *Callee, SourceLocation LParenLoc, Expr *LHS, BinaryOperatorKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc, Optional< unsigned > NumExpansions)
DeclContext * computeDeclContext(QualType T)
Compute the DeclContext that is associated with the given type.
ExprResult BuildObjCBoxedExpr(SourceRange SR, Expr *ValueExpr)
BuildObjCBoxedExpr - builds an ObjCBoxedExpr AST node for the '@' prefixed parenthesized expression.
ExprResult SemaConvertVectorExpr(Expr *E, TypeSourceInfo *TInfo, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
SemaConvertVectorExpr - Handle __builtin_convertvector.
bool LookupInlineAsmField(StringRef Base, StringRef Member, unsigned &Offset, SourceLocation AsmLoc)
PragmaClangSection PragmaClangTextSection
Definition Sema.h:474
ExprResult ActOnObjCBoolLiteral(SourceLocation OpLoc, tok::TokenKind Kind)
ActOnObjCBoolLiteral - Parse {__objc_yes,__objc_no} literals.
bool resolveAndFixAddressOfSingleOverloadCandidate(ExprResult &SrcExpr, bool DoFunctionPointerConversion=false)
Given an overloaded function, tries to turn it into a non-overloaded function reference using resolve...
void WarnConflictingTypedMethods(ObjCMethodDecl *Method, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl)
LabelDecl * LookupOrCreateLabel(IdentifierInfo *II, SourceLocation IdentLoc, SourceLocation GnuLabelLoc=SourceLocation())
LookupOrCreateLabel - Do a name lookup of a label with the specified name.
void ActOnFinishCXXInClassMemberInitializer(Decl *VarDecl, SourceLocation EqualLoc, Expr *Init)
This is invoked after parsing an in-class initializer for a non-static C++ class member,...
ARCConversionResult CheckObjCConversion(SourceRange castRange, QualType castType, Expr *&op, CheckedConversionKind CCK, bool Diagnose=true, bool DiagnoseCFAudited=false, BinaryOperatorKind Opc=BO_PtrMemD)
Checks for invalid conversions and casts between retainable pointers and other pointer kinds for ARC ...
NonTrivialCUnionKind
Definition Sema.h:2953
@ NTCUK_Destruct
Definition Sema.h:2955
@ NTCUK_Init
Definition Sema.h:2954
@ NTCUK_Copy
Definition Sema.h:2956
QualType CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc)
Check that the type of a non-type template parameter is well-formed.
QualType CheckPointerToMemberOperands(ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, SourceLocation OpLoc, bool isIndirect)
void CheckLookupAccess(const LookupResult &R)
Checks access to all the declarations in the given result set.
concepts::ExprRequirement * BuildExprRequirement(Expr *E, bool IsSatisfied, SourceLocation NoexceptLoc, concepts::ExprRequirement::ReturnTypeRequirement ReturnTypeRequirement)
QualType BuildAtomicType(QualType T, SourceLocation Loc)
QualType CheckTemplateIdType(TemplateName Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs)
PragmaClangSection PragmaClangDataSection
Definition Sema.h:471
bool DiagRuntimeBehavior(SourceLocation Loc, const Stmt *Statement, const PartialDiagnostic &PD)
Conditionally issue a diagnostic based on the current evaluation context.
Decl * ActOnFinishFunctionBody(Decl *Decl, Stmt *Body)
SemaDiagnosticBuilder CUDADiagIfHostCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as host cod...
Definition SemaCUDA.cpp:757
llvm::Error isValidSectionSpecifier(StringRef Str)
Used to implement to perform semantic checking on attribute((section("foo"))) specifiers.
void CodeCompleteObjCSuperMessage(Scope *S, SourceLocation SuperLoc, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression)
Decl * ActOnPropertyImplDecl(Scope *S, SourceLocation AtLoc, SourceLocation PropertyLoc, bool ImplKind, IdentifierInfo *PropertyId, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc, ObjCPropertyQueryKind QueryKind)
ActOnPropertyImplDecl - This routine performs semantic checks and builds the AST node for a property ...
void ActOnStartOfFunctionDefinitionInOpenMPDeclareVariantScope(Scope *S, Declarator &D, MultiTemplateParamsArg TemplateParameterLists, SmallVectorImpl< FunctionDecl * > &Bases)
The declarator D defines a function in the scope S which is nested in an omp begin/end declare varian...
DeclGroupPtrTy ActOnOpenMPDeclareMapperDirective(Scope *S, DeclContext *DC, DeclarationName Name, QualType MapperType, SourceLocation StartLoc, DeclarationName VN, AccessSpecifier AS, Expr *MapperVarRef, ArrayRef< OMPClause * > Clauses, Decl *PrevDeclInScope=nullptr)
Called on start of '#pragma omp declare mapper'.
StmtResult ActOnOpenMPTargetParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target parallel for simd' after parsing of the associated statemen...
ParsedType actOnLambdaInitCaptureInitialization(SourceLocation Loc, bool ByRef, SourceLocation EllipsisLoc, IdentifierInfo *Id, LambdaCaptureInitKind InitKind, Expr *&Init)
Perform initialization analysis of the init-capture and perform any implicit conversions such as an l...
Definition Sema.h:6969
OMPClause * ActOnOpenMPWhenClause(OMPTraitInfo &TI, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'when' clause.
void ActOnInitializerError(Decl *Dcl)
ActOnInitializerError - Given that there was an error parsing an initializer for the given declaratio...
bool anyAltivecTypes(QualType srcType, QualType destType)
void FilterAcceptableTemplateNames(LookupResult &R, bool AllowFunctionTemplates=true, bool AllowDependent=true)
TypeSourceInfo * SubstAutoTypeSourceInfoDependent(TypeSourceInfo *TypeWithAuto)
void * SkippedDefinitionContext
Definition Sema.h:3370
bool isLaxVectorConversion(QualType srcType, QualType destType)
Is this a legal conversion between two types, one of which is known to be a vector type?
void PushNamespaceVisibilityAttr(const VisibilityAttr *Attr, SourceLocation Loc)
PushNamespaceVisibilityAttr - Note that we've entered a namespace with a visibility attribute.
ExprResult LookupInlineAsmVarDeclField(Expr *RefExpr, StringRef Member, SourceLocation AsmLoc)
ExprResult ActOnNameClassifiedAsUndeclaredNonType(IdentifierInfo *Name, SourceLocation NameLoc)
Act on the result of classifying a name as an undeclared (ADL-only) non-type declaration.
void PushBlockScope(Scope *BlockScope, BlockDecl *Block)
Definition Sema.cpp:2086
bool CheckCXXDefaultArgExpr(SourceLocation CallLoc, FunctionDecl *FD, ParmVarDecl *Param)
Instantiate or parse a C++ default argument expression as necessary.
sema::FunctionScopeInfo * getCurFunctionAvailabilityContext()
Retrieve the current function, if any, that should be analyzed for potential availability violations.
void ActOnDefaultCtorInitializers(Decl *CDtorDecl)
void ActOnMemInitializers(Decl *ConstructorDecl, SourceLocation ColonLoc, ArrayRef< CXXCtorInitializer * > MemInits, bool AnyErrors)
ActOnMemInitializers - Handle the member initializers for a constructor.
ExprResult BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc, Expr *ExecConfig, bool AllowTypoCorrection=true, bool CalleesAddressIsTaken=false)
BuildOverloadedCallExpr - Given the call expression that calls Fn (which eventually refers to the dec...
void ActOnPragmaRedefineExtname(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaRedefineExtname - Called on well formed #pragma redefine_extname oldname newname.
bool CheckTemplateDeclScope(Scope *S, TemplateParameterList *TemplateParams)
Check whether a template can be declared within this scope.
llvm::SmallDenseMap< const ValueDecl *, const Expr *, 4 > VarsWithInheritedDSAType
Definition Sema.h:10981
PragmaStack< MSVtorDispMode > VtorDispStack
Whether to insert vtordisps prior to virtual bases in the Microsoft C++ ABI.
Definition Sema.h:679
TypeSourceInfo * ReplaceAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
void AddMsStructLayoutForRecord(RecordDecl *RD)
AddMsStructLayoutForRecord - Adds ms_struct layout attribute to record.
Definition SemaAttr.cpp:86
QualType CXXCheckConditionalOperands(ExprResult &cond, ExprResult &lhs, ExprResult &rhs, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation questionLoc)
Check the operands of ?: under C++ semantics.
ExprResult BuildAnonymousStructUnionMemberReference(const CXXScopeSpec &SS, SourceLocation nameLoc, IndirectFieldDecl *indirectField, DeclAccessPair FoundDecl=DeclAccessPair::make(nullptr, AS_none), Expr *baseObjectExpr=nullptr, SourceLocation opLoc=SourceLocation())
void AddFactoryMethodToGlobalPool(ObjCMethodDecl *Method, bool impl=false)
AddFactoryMethodToGlobalPool - Same as above, but for factory methods.
Definition Sema.h:4815
MaybeODRUseExprSet MaybeODRUseExprs
Definition Sema.h:790
ExternalSemaSource * getExternalSource() const
Definition Sema.h:1628
void ActOnCXXEnterDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXEnterDeclInitializer - Invoked when we are about to parse an initializer for the declaration ...
unsigned FunctionScopesStart
The index of the first FunctionScope that corresponds to the current context.
Definition Sema.h:800
void * VisContext
VisContext - Manages the stack for #pragma GCC visibility.
Definition Sema.h:730
NamedDecl * lookupOpenMPDeclareTargetName(Scope *CurScope, CXXScopeSpec &ScopeSpec, const DeclarationNameInfo &Id)
Searches for the provided declaration name for OpenMP declare target directive.
QualType FindCompositePointerType(SourceLocation Loc, ExprResult &E1, ExprResult &E2, bool ConvertArgs=true)
Definition Sema.h:12210
bool InstantiateInClassInitializer(SourceLocation PointOfInstantiation, FieldDecl *Instantiation, FieldDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Instantiate the definition of a field from the given pattern.
void ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope, bool IsInstantiation=false)
ActOnLambdaError - If there is an error parsing a lambda, this callback is invoked to pop the informa...
StmtResult ActOnOpenMPSectionDirective(Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp section' after parsing of the associated statement.
Decl * ActOnUsingEnumDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation EnumLoc, const DeclSpec &)
static SourceRange getPrintable(SourceRange R)
Definition Sema.h:2153
DeclGroupPtrTy ActOnOpenMPDeclareReductionDirectiveEnd(Scope *S, DeclGroupPtrTy DeclReductions, bool IsValid)
Called at the end of '#pragma omp declare reduction'.
bool CheckParmsForFunctionDef(ArrayRef< ParmVarDecl * > Parameters, bool CheckParameterNames)
Helpers for dealing with blocks and functions.
void ActOnFinishCXXMemberSpecification(Scope *S, SourceLocation RLoc, Decl *TagDecl, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
void ActOnOpenMPBeginDeclareVariant(SourceLocation Loc, OMPTraitInfo &TI)
Handle a omp begin declare variant.
void CheckShadow(NamedDecl *D, NamedDecl *ShadowedDecl, const LookupResult &R)
Diagnose variable or built-in function shadowing.
ParsedTemplateArgument ActOnPackExpansion(const ParsedTemplateArgument &Arg, SourceLocation EllipsisLoc)
Invoked when parsing a template argument followed by an ellipsis, which creates a pack expansion.
void ActOnUndeclaredTypeTemplateName(Scope *S, TemplateTy &Name, TemplateNameKind &TNK, SourceLocation NameLoc, IdentifierInfo *&II)
Try to resolve an undeclared template name as a type template.
ExprResult BuildCallToObjectOfClassType(Scope *S, Expr *Object, SourceLocation LParenLoc, MultiExprArg Args, SourceLocation RParenLoc)
BuildCallToObjectOfClassType - Build a call to an object of class type (C++ [over....
void AdjustDestructorExceptionSpec(CXXDestructorDecl *Destructor)
Build an exception spec for destructors that don't have one.
Decl * ActOnStaticAssertDeclaration(SourceLocation StaticAssertLoc, Expr *AssertExpr, Expr *AssertMessageExpr, SourceLocation RParenLoc)
ExprResult ActOnStringLiteral(ArrayRef< Token > StringToks, Scope *UDLScope=nullptr)
ActOnStringLiteral - The specified tokens were lexed as pasted string fragments (e....
bool CheckMemberSpecialization(NamedDecl *Member, LookupResult &Previous)
Perform semantic analysis for the given non-template member specialization.
StmtResult ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body)
bool inferCUDATargetForImplicitSpecialMember(CXXRecordDecl *ClassDecl, CXXSpecialMember CSM, CXXMethodDecl *MemberDecl, bool ConstRHS, bool Diagnose)
Given a implicit special member, infer its CUDA target from the calls it needs to make to underlying ...
Definition SemaCUDA.cpp:324
StmtResult BuildReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp, bool AllowRecovery=false)
void ProcessPropertyDecl(ObjCPropertyDecl *property)
Process the specified property declaration and create decls for the setters and getters as needed.
bool isCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind=CompleteTypeKind::Default)
Definition Sema.h:2428
void ActOnObjCReenterContainerContext(ObjCContainerDecl *ObjCCtx)
ExprResult ActOnBinOp(Scope *S, SourceLocation TokLoc, tok::TokenKind Kind, Expr *LHSExpr, Expr *RHSExpr)
ExprResult BuildQualifiedTemplateIdExpr(CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
void PushCapturedRegionScope(Scope *RegionScope, CapturedDecl *CD, RecordDecl *RD, CapturedRegionKind K, unsigned OpenMPCaptureLevel=0)
Definition Sema.cpp:2628
bool InstantiateClass(SourceLocation PointOfInstantiation, CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK, bool Complain=true)
Instantiate the definition of a class from a given pattern.
OptimizeNoneAttr * mergeOptimizeNoneAttr(Decl *D, const AttributeCommonInfo &CI)
std::pair< const IdentifierInfo *, uint64_t > TypeTagMagicValue
A pair of ArgumentKind identifier and magic value.
Definition Sema.h:13300
void emitDeferredDiags()
Definition Sema.cpp:1758
VarDecl * isOpenMPCapturedDecl(ValueDecl *D, bool CheckScopeInfo=false, unsigned StopAt=0)
Check if the specified variable is used in one of the private clauses (private, firstprivate,...
void setFunctionHasMustTail()
Definition Sema.cpp:2255
ExprResult BuildPseudoDestructorExpr(Expr *Base, SourceLocation OpLoc, tok::TokenKind OpKind, const CXXScopeSpec &SS, TypeSourceInfo *ScopeType, SourceLocation CCLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
void checkUnusedDeclAttributes(Declarator &D)
checkUnusedDeclAttributes - Given a declarator which is not being used to build a declaration,...
bool WarnedStackExhausted
Definition Sema.h:1584
bool hasReachableMemberSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is a member specialization declaration (as op...
ExprResult CheckExtVectorCast(SourceRange R, QualType DestTy, Expr *CastExpr, CastKind &Kind)
void CodeCompleteObjCInterfaceCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
ObjCInterfaceDecl * getObjCInterfaceDecl(IdentifierInfo *&Id, SourceLocation IdLoc, bool TypoCorrection=false)
Look for an Objective-C class in the translation unit.
RecordDecl * CXXTypeInfoDecl
The C++ "type_info" declaration, which is defined in <typeinfo>.
Definition Sema.h:1154
void InstantiateDefaultCtorDefaultArgs(CXXConstructorDecl *Ctor)
In the MS ABI, we need to instantiate default arguments of dllexported default constructors along wit...
CorrectTypoKind
Definition Sema.h:4401
@ CTK_NonError
Definition Sema.h:4402
@ CTK_ErrorRecovery
Definition Sema.h:4403
void CheckCompleteVariableDeclaration(VarDecl *VD)
bool CanPerformAggregateInitializationForOverloadResolution(const InitializedEntity &Entity, InitListExpr *From)
Determine whether we can perform aggregate initialization for the purposes of overload resolution.
ExprResult ActOnRequiresClause(ExprResult ConstraintExpr)
@ Global
The global module fragment, between 'module;' and a module-declaration.
Definition Sema.h:1901
@ Normal
A normal translation unit fragment.
Definition Sema.h:1905
void checkClassLevelCodeSegAttribute(CXXRecordDecl *Class)
QualType BuildPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a pointer type.
bool isStdInitializerList(QualType Ty, QualType *Element)
Tests whether Ty is an instance of std::initializer_list and, if it is and Element is not NULL,...
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS, ArrayRef< Decl * > Group)
void ActOnOpenMPDeclareVariantDirective(FunctionDecl *FD, Expr *VariantRef, OMPTraitInfo &TI, ArrayRef< Expr * > AdjustArgsNothing, ArrayRef< Expr * > AdjustArgsNeedDevicePtr, ArrayRef< OMPDeclareVariantAttr::InteropType > AppendArgs, SourceLocation AdjustArgsLoc, SourceLocation AppendArgsLoc, SourceRange SR)
Called on well-formed '#pragma omp declare variant' after parsing of the associated method/function.
void setFunctionHasBranchProtectedScope()
Definition Sema.cpp:2245
bool hasReachableDefinition(NamedDecl *D)
Definition Sema.h:2372
void MergeVarDecl(VarDecl *New, LookupResult &Previous)
MergeVarDecl - We just parsed a variable 'New' which has the same name and scope as a previous declar...
ExprResult ActOnOMPArrayShapingExpr(Expr *Base, SourceLocation LParenLoc, SourceLocation RParenLoc, ArrayRef< Expr * > Dims, ArrayRef< SourceRange > Brackets)
QualType BuildUnaryTransformType(QualType BaseType, UnaryTransformType::UTTKind UKind, SourceLocation Loc)
bool CheckLoopHintExpr(Expr *E, SourceLocation Loc)
OMPClause * ActOnOpenMPCopyprivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'copyprivate' clause.
void CUDASetLambdaAttrs(CXXMethodDecl *Method)
Set device or host device attributes on the given lambda operator() method.
Definition SemaCUDA.cpp:897
bool CheckAttrTarget(const ParsedAttr &CurrAttr)
FunctionEmissionStatus getEmissionStatus(FunctionDecl *Decl, bool Final=false)
LazyDeclPtr StdNamespace
The C++ "std" namespace, where the standard library resides.
Definition Sema.h:1127
DeclResult ActOnVarTemplateSpecialization(Scope *S, Declarator &D, TypeSourceInfo *DI, SourceLocation TemplateKWLoc, TemplateParameterList *TemplateParams, StorageClass SC, bool IsPartialSpecialization)
StmtResult ActOnFinishSEHFinallyBlock(SourceLocation Loc, Stmt *Block)
DelayedDiagnosticsState ParsingDeclState
Definition Sema.h:934
ParsedType ActOnMSVCUnknownTypeName(const IdentifierInfo &II, SourceLocation NameLoc, bool IsTemplateTypeArg)
Attempt to behave like MSVC in situations where lookup of an unqualified type name has failed in a de...
Definition SemaDecl.cpp:581
OMPClause * ActOnOpenMPDepobjClause(Expr *Depobj, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'depobj' pseudo clause.
void SetFunctionBodyKind(Decl *D, SourceLocation Loc, FnBodyKind BodyKind)
bool DeclareRISCVVBuiltins
Indicate RISC-V vector builtin functions enabled or not.
Definition Sema.h:1592
void InstantiateFunctionDefinition(SourceLocation PointOfInstantiation, FunctionDecl *Function, bool Recursive=false, bool DefinitionRequired=false, bool AtEndOfTU=false)
Instantiate the definition of the given function from its template.
QualType ActOnOpenMPDeclareMapperType(SourceLocation TyLoc, TypeResult ParsedType)
Check if the specified type is allowed to be used in 'omp declare mapper' construct.
bool CheckUsingDeclRedeclaration(SourceLocation UsingLoc, bool HasTypenameKeyword, const CXXScopeSpec &SS, SourceLocation NameLoc, const LookupResult &Previous)
Checks that the given using declaration is not an invalid redeclaration.
OMPClause * ActOnOpenMPThreadLimitClause(Expr *ThreadLimit, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'thread_limit' clause.
void NoteOverloadCandidate(NamedDecl *Found, FunctionDecl *Fn, OverloadCandidateRewriteKind RewriteKind=OverloadCandidateRewriteKind(), QualType DestType=QualType(), bool TakingAddress=false)
StmtResult ActOnContinueStmt(SourceLocation ContinueLoc, Scope *CurScope)
void CodeCompleteObjCClassMessage(Scope *S, ParsedType Receiver, ArrayRef< IdentifierInfo * > SelIdents, bool AtArgumentExpression, bool IsSuper=false)
bool ActOnStartOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called on the start of target region i.e. '#pragma omp declare target'.
EnforceTCBLeafAttr * mergeEnforceTCBLeafAttr(Decl *D, const EnforceTCBLeafAttr &AL)
const DeclareTargetContextInfo ActOnOpenMPEndDeclareTargetDirective()
Called at the end of target region i.e. '#pragma omp end declare target'.
void ActOnStartOfTranslationUnit()
This is called before the very first declaration in the translation unit is parsed.
Definition Sema.cpp:1021
CCEKind
Contexts in which a converted constant expression is required.
Definition Sema.h:3722
@ CCEK_ExplicitBool
Condition in an explicit(bool) specifier.
Definition Sema.h:3727
@ CCEK_Noexcept
Condition in a noexcept(bool) specifier.
Definition Sema.h:3728
@ CCEK_ArrayBound
Array bound in array declarator or new-expression.
Definition Sema.h:3726
@ CCEK_CaseValue
Expression in a case label.
Definition Sema.h:3723
@ CCEK_TemplateArg
Value of a non-type template parameter.
Definition Sema.h:3725
@ CCEK_Enumerator
Enumerator value with fixed underlying type.
Definition Sema.h:3724
void StartOpenMPClause(OpenMPClauseKind K)
Start analysis of clauses.
OMPClause * ActOnOpenMPPrivateClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'private' clause.
CUDAVariableTarget
Definition Sema.h:12689
@ CVT_Both
Emitted on host side only.
Definition Sema.h:12692
@ CVT_Unified
Emitted on both sides with different addresses.
Definition Sema.h:12693
@ CVT_Host
Emitted on device side with a shadow variable on host side.
Definition Sema.h:12691
StmtResult ActOnDoStmt(SourceLocation DoLoc, Stmt *Body, SourceLocation WhileLoc, SourceLocation CondLParen, Expr *Cond, SourceLocation CondRParen)
StmtResult ActOnOpenMPDispatchDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp dispatch' after parsing of the.
CXXConstructorDecl * LookupCopyingConstructor(CXXRecordDecl *Class, unsigned Quals)
Look up the copying constructor for the given class.
void ActOnLastBitfield(SourceLocation DeclStart, SmallVectorImpl< Decl * > &AllIvarDecls)
ActOnLastBitfield - This routine handles synthesized bitfields rules for class and class extensions.
void InstantiateAttrsForDecl(const MultiLevelTemplateArgumentList &TemplateArgs, const Decl *Pattern, Decl *Inst, LateInstantiatedAttrVec *LateAttrs=nullptr, LocalInstantiationScope *OuterMostScope=nullptr)
CUDAFunctionTarget
Definition Sema.h:12672
@ CFT_HostDevice
Definition Sema.h:12676
@ CFT_InvalidTarget
Definition Sema.h:12677
bool hasVisibleMergedDefinition(NamedDecl *Def)
StmtResult ActOnStartOfSwitchStmt(SourceLocation SwitchLoc, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc)
void mergeDeclAttributes(NamedDecl *New, Decl *Old, AvailabilityMergeKind AMK=AMK_Redeclaration)
mergeDeclAttributes - Copy attributes from the Old decl to the New one.
void MarkUnusedFileScopedDecl(const DeclaratorDecl *D)
If it's a file scoped decl that must warn if not used, keep track of it.
ExprResult ActOnInstanceMessage(Scope *S, Expr *Receiver, Selector Sel, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args)
OMPClause * ActOnOpenMPNontemporalClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'nontemporal' clause.
void actOnObjCTypeArgsOrProtocolQualifiers(Scope *S, ParsedType baseType, SourceLocation lAngleLoc, ArrayRef< IdentifierInfo * > identifiers, ArrayRef< SourceLocation > identifierLocs, SourceLocation rAngleLoc, SourceLocation &typeArgsLAngleLoc, SmallVectorImpl< ParsedType > &typeArgs, SourceLocation &typeArgsRAngleLoc, SourceLocation &protocolLAngleLoc, SmallVectorImpl< Decl * > &protocols, SourceLocation &protocolRAngleLoc, bool warnOnIncompleteProtocols)
Given a list of identifiers (and their locations), resolve the names to either Objective-C protocol q...
EnumConstantDecl * CheckEnumConstant(EnumDecl *Enum, EnumConstantDecl *LastEnumConst, SourceLocation IdLoc, IdentifierInfo *Id, Expr *val)
OMPClause * ActOnOpenMPUnifiedAddressClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'unified_address' clause.
StmtResult ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, Stmt *LoopVar, SourceLocation ColonLoc, Expr *Collection, SourceLocation RParenLoc, BuildForRangeKind Kind)
ActOnCXXForRangeStmt - Check and build a C++11 for-range statement.
TypeResult actOnObjCProtocolQualifierType(SourceLocation lAngleLoc, ArrayRef< Decl * > protocols, ArrayRef< SourceLocation > protocolLocs, SourceLocation rAngleLoc)
Build a an Objective-C protocol-qualified 'id' type where no base type was specified.
bool isInOpenMPTargetExecutionDirective() const
Return true inside OpenMP target region.
ASTConsumer & Consumer
Definition Sema.h:410
void DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *CDecl, bool SynthesizeProperties)
DiagnoseUnimplementedProperties - This routine warns on those properties which must be implemented by...
bool handlerCanCatch(QualType HandlerType, QualType ExceptionType)
OverloadKind CheckOverload(Scope *S, FunctionDecl *New, const LookupResult &OldDecls, NamedDecl *&OldDecl, bool IsForUsingDecl)
Determine whether the given New declaration is an overload of the declarations in Old.
RequiresExprBodyDecl * ActOnStartRequiresExpr(SourceLocation RequiresKWLoc, ArrayRef< ParmVarDecl * > LocalParameters, Scope *BodyScope)
void AddFunctionCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, bool SuppressUserConversions=false, bool PartialOverloading=false, bool FirstArgumentIsBase=false)
Add all of the function declarations in the given function set to the overload candidate set.
void ActOnFinishCXXMemberDecls()
Perform any semantic analysis which needs to be delayed until all pending class member declarations h...
const DeclContext * getCurObjCLexicalContext() const
Definition Sema.h:13380
void inheritCUDATargetAttrs(FunctionDecl *FD, const FunctionTemplateDecl &TD)
Copies target attributes from the template TD to the function FD.
Definition SemaCUDA.cpp:944
ExprResult ParseObjCEncodeExpression(SourceLocation AtLoc, SourceLocation EncodeLoc, SourceLocation LParenLoc, ParsedType Ty, SourceLocation RParenLoc)
OverloadKind
C++ Overloading.
Definition Sema.h:3617
@ Ovl_NonFunction
This is not an overload because the lookup results contain a non-function.
Definition Sema.h:3628
@ Ovl_Overload
This is a legitimate overload: the existing declarations are functions or function templates with dif...
Definition Sema.h:3620
@ Ovl_Match
This is not an overload because the signature exactly matches an existing declaration.
Definition Sema.h:3624
PragmaAlignPackDiagnoseKind
Definition Sema.h:10269
bool CheckPointerConversion(Expr *From, QualType ToType, CastKind &Kind, CXXCastPath &BasePath, bool IgnoreBaseAccess, bool Diagnose=true)
CheckPointerConversion - Check the pointer conversion from the expression From to the type ToType.
SmallVector< ExprWithCleanups::CleanupObject, 8 > ExprCleanupObjects
ExprCleanupObjects - This is the stack of objects requiring cleanup that are created by the current f...
Definition Sema.h:781
void NoteDeletedFunction(FunctionDecl *FD)
Emit a note explaining that this function is deleted.
Definition SemaExpr.cpp:114
void DiagnoseUnusedNestedTypedefs(const RecordDecl *D)
sema::AnalysisBasedWarnings AnalysisWarnings
Worker object for performing CFG-based warnings.
Definition Sema.h:9499
bool hasUncompilableErrorOccurred() const
Whether uncompilable error has occurred.
Definition Sema.cpp:1568
Optional< std::pair< FunctionDecl *, Expr * > > checkOpenMPDeclareVariantFunction(DeclGroupPtrTy DG, Expr *VariantRef, OMPTraitInfo &TI, unsigned NumAppendArgs, SourceRange SR)
Checks '#pragma omp declare variant' variant function and original functions after parsing of the ass...
std::deque< PendingImplicitInstantiation > PendingInstantiations
The queue of implicit template instantiations that are required but have not yet been performed.
Definition Sema.h:9514
bool ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, InheritedConstructorInfo *ICI=nullptr, bool Diagnose=false)
Determine if a special member function should have a deleted definition when it is defaulted.
ExprResult CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, Expr *Idx, SourceLocation RLoc)
Decl * ActOnFinishLinkageSpecification(Scope *S, Decl *LinkageSpec, SourceLocation RBraceLoc)
ActOnFinishLinkageSpecification - Complete the definition of the C++ linkage specification LinkageSpe...
ModuleImportState
An enumeration to represent the transition of states in parsing module fragments and imports.
Definition Sema.h:3079
@ ImportFinished
after any non-import decl.
@ FirstDecl
Parsing the first decl in a TU.
@ GlobalFragment
after 'module;' but before 'module X;'
@ PrivateFragment
after 'module :private;'.
@ NotACXX20Module
Not a C++20 TU, or an invalid state was found.
@ ImportAllowed
after 'module X;' but before any non-import decl.
void CodeCompleteObjCPassingType(Scope *S, ObjCDeclSpec &DS, bool IsParameter)
void NoteAllOverloadCandidates(Expr *E, QualType DestType=QualType(), bool TakingAddress=false)
StmtResult ActOnOpenMPTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams loop' after parsing of the associated statement.
bool MatchTwoMethodDeclarations(const ObjCMethodDecl *Method, const ObjCMethodDecl *PrevMethod, MethodMatchStrategy strategy=MMS_strict)
MatchTwoMethodDeclarations - Checks if two methods' type match and returns true, or false,...
void MarkUsedTemplateParameters(const Expr *E, bool OnlyDeduced, unsigned Depth, llvm::SmallBitVector &Used)
Mark which template parameters are used in a given expression.
OMPClause * ActOnOpenMPThreadsClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'threads' clause.
void ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &OldVal, unsigned NewWidth, bool NewSign, SourceLocation Loc, unsigned DiagID)
ConvertIntegerToTypeWarnOnOverflow - Convert the specified APInt to have the specified width and sign...
static QualType getPrintable(QualType T)
Definition Sema.h:2152
ExprResult ActOnPredefinedExpr(SourceLocation Loc, tok::TokenKind Kind)
void CodeCompleteConstructorInitializer(Decl *Constructor, ArrayRef< CXXCtorInitializer * > Initializers)
QualType GetSignedVectorType(QualType V)
ModuleLoader & getModuleLoader() const
Retrieve the module loader associated with the preprocessor.
Definition Sema.cpp:59
StmtResult ActOnMSDependentExistsStmt(SourceLocation KeywordLoc, bool IsIfExists, CXXScopeSpec &SS, UnqualifiedId &Name, Stmt *Nested)
OMPClause * ActOnOpenMPAtomicDefaultMemOrderClause(OpenMPAtomicDefaultMemOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'atomic_default_mem_order' clause.
AccessResult CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair FoundDecl)
void incrementMSManglingNumber() const
Definition Sema.h:13367
bool CheckDistantExceptionSpec(QualType T)
CheckDistantExceptionSpec - Check if the given type is a pointer or pointer to member to a function w...
bool isAcceptableNestedNameSpecifier(const NamedDecl *SD, bool *CanCorrect=nullptr)
Determines whether the given declaration is an valid acceptable result for name lookup of a nested-na...
DeclResult ActOnExplicitInstantiation(Scope *S, SourceLocation ExternLoc, SourceLocation TemplateLoc, unsigned TagSpec, SourceLocation KWLoc, const CXXScopeSpec &SS, TemplateTy Template, SourceLocation TemplateNameLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, const ParsedAttributesView &Attr)
bool CheckInheritingConstructorUsingDecl(UsingDecl *UD)
Additional checks for a using declaration referring to a constructor name.
void AddNonMemberOperatorCandidates(const UnresolvedSetImpl &Functions, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr)
Add all of the non-member operator function declarations in the given function set to the overload ca...
ObjCIvarDecl * GetIvarBackingPropertyAccessor(const ObjCMethodDecl *Method, const ObjCPropertyDecl *&PDecl) const
GetIvarBackingPropertyAccessor - If method is a property setter/getter and it property has a backing ...
QualType CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, ExprResult &RHS, ExprValueKind &VK, ExprObjectKind &OK, SourceLocation QuestionLoc)
Note that LHS is not null here, even if this is the gnu "x ?: y" extension.
void AddKnownFunctionAttributesForReplaceableGlobalAllocationFunction(FunctionDecl *FD)
If this function is a C++ replaceable global allocation function (C++2a [basic.stc....
void ImplMethodsVsClassMethods(Scope *S, ObjCImplDecl *IMPDecl, ObjCContainerDecl *IDecl, bool IncompleteImpl=false)
ImplMethodsVsClassMethods - This is main routine to warn if any method remains unimplemented in the c...
bool inferObjCARCLifetime(ValueDecl *decl)
VarDecl * createLambdaInitCaptureVarDecl(SourceLocation Loc, QualType InitCaptureType, SourceLocation EllipsisLoc, IdentifierInfo *Id, unsigned InitStyle, Expr *Init)
Create a dummy variable within the declcontext of the lambda's call operator, for name lookup purpose...
ExpressionEvaluationContext
Describes how the expressions currently being parsed are evaluated at run-time, if at all.
Definition Sema.h:1217
@ UnevaluatedAbstract
The current expression occurs within an unevaluated operand that unconditionally permits abstract ref...
@ UnevaluatedList
The current expression occurs within a braced-init-list within an unevaluated operand.
@ ConstantEvaluated
The current context is "potentially evaluated" in C++11 terms, but the expression is evaluated at com...
@ DiscardedStatement
The current expression occurs within a discarded statement.
@ PotentiallyEvaluated
The current expression is potentially evaluated at run time, which means that code may be generated t...
@ Unevaluated
The current expression and its subexpressions occur within an unevaluated operand (C++11 [expr]p7),...
@ ImmediateFunctionContext
In addition of being constant evaluated, the current expression occurs in an immediate function conte...
@ PotentiallyEvaluatedIfUsed
The current expression is potentially evaluated, but any declarations referenced inside that expressi...
CUDAFunctionTarget CurrentCUDATarget()
Gets the CUDA target for the current context.
Definition Sema.h:12699
void CheckCompatibleReinterpretCast(QualType SrcType, QualType DestType, bool IsDereference, SourceRange Range)
QualType BuildDecltypeType(Expr *E, bool AsUnevaluated=true)
If AsUnevaluated is false, E is treated as though it were an evaluated context, such as when building...
unsigned LastEmittedCodeSynthesisContextDepth
The depth of the context stack at the point when the most recent error or warning was produced.
Definition Sema.h:9151
FormatAttr * mergeFormatAttr(Decl *D, const AttributeCommonInfo &CI, IdentifierInfo *Format, int FormatIdx, int FirstArg)
ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
AvailabilityPriority
Describes the kind of priority given to an availability attribute.
Definition Sema.h:3519
@ AP_PragmaClangAttribute
The availability attribute was applied using '#pragma clang attribute'.
Definition Sema.h:3525
@ AP_InferredFromOtherPlatform
The availability attribute for a specific platform was inferred from an availability attribute for an...
Definition Sema.h:3529
@ AP_Explicit
The availability attribute was specified explicitly next to the declaration.
Definition Sema.h:3522
AvailabilityMergeKind
Describes the kind of merge to perform for availability attributes (including "deprecated",...
Definition Sema.h:3490
@ AMK_None
Don't merge availability attributes at all.
Definition Sema.h:3492
@ AMK_Override
Merge availability attributes for an override, which requires an exact match or a weakening of constr...
Definition Sema.h:3498
@ AMK_ProtocolImplementation
Merge availability attributes for an implementation of a protocol requirement.
Definition Sema.h:3501
@ AMK_OptionalProtocolImplementation
Merge availability attributes for an implementation of an optional protocol requirement.
Definition Sema.h:3504
@ AMK_Redeclaration
Merge availability attributes for a redeclaration, which requires an exact match.
Definition Sema.h:3495
void ActOnDocumentableDecls(ArrayRef< Decl * > Group)
ExprResult ActOnAsTypeExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_astype(...)
StmtResult BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc, Stmt *InitStmt, SourceLocation ColonLoc, Stmt *RangeDecl, Stmt *Begin, Stmt *End, Expr *Cond, Expr *Inc, Stmt *LoopVarDecl, SourceLocation RParenLoc, BuildForRangeKind Kind)
BuildCXXForRangeStmt - Build or instantiate a C++11 for-range statement.
StmtResult ActOnSEHExceptBlock(SourceLocation Loc, Expr *FilterExpr, Stmt *Block)
ExprResult CreateUnaryExprOrTypeTraitExpr(TypeSourceInfo *TInfo, SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, SourceRange R)
Build a sizeof or alignof expression given a type operand.
void CheckStaticLocalForDllExport(VarDecl *VD)
Check if VD needs to be dllexport/dllimport due to being in a dllexport/import function.
ExprResult BuildOperatorCoawaitLookupExpr(Scope *S, SourceLocation Loc)
bool CheckExceptionSpecSubset(const PartialDiagnostic &DiagID, const PartialDiagnostic &NestedDiagID, const PartialDiagnostic &NoteID, const PartialDiagnostic &NoThrowDiagID, const FunctionProtoType *Superset, SourceLocation SuperLoc, const FunctionProtoType *Subset, SourceLocation SubLoc)
CheckExceptionSpecSubset - Check whether the second function type's exception specification is a subs...
void diagnoseTypo(const TypoCorrection &Correction, const PartialDiagnostic &TypoDiag, bool ErrorRecovery=true)
bool CheckCallReturnType(QualType ReturnType, SourceLocation Loc, CallExpr *CE, FunctionDecl *FD)
CheckCallReturnType - Checks that a call expression's return type is complete.
bool CheckUnaryExprOrTypeTraitOperand(Expr *E, UnaryExprOrTypeTrait ExprKind)
Check the constraints on expression operands to unary type expression and type traits.
bool CheckParameterPacksForExpansion(SourceLocation EllipsisLoc, SourceRange PatternRange, ArrayRef< UnexpandedParameterPack > Unexpanded, const MultiLevelTemplateArgumentList &TemplateArgs, bool &ShouldExpand, bool &RetainExpansion, Optional< unsigned > &NumExpansions)
Determine whether we could expand a pack expansion with the given set of parameter packs into separat...
Decl * ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, DeclSpec &DS, const ParsedAttributesView &DeclAttrs, RecordDecl *&AnonRecord)
ParsedFreeStandingDeclSpec - This method is invoked when a declspec with no declarator (e....
ParsedType getDestructorName(SourceLocation TildeLoc, IdentifierInfo &II, SourceLocation NameLoc, Scope *S, CXXScopeSpec &SS, ParsedType ObjectType, bool EnteringContext)
void addMethodToGlobalList(ObjCMethodList *List, ObjCMethodDecl *Method)
Add the given method to the list of globally-known methods.
void CodeCompleteModuleImport(SourceLocation ImportLoc, ModuleIdPath Path)
void ActOnFinishNamespaceDef(Decl *Dcl, SourceLocation RBrace)
ActOnFinishNamespaceDef - This callback is called after a namespace is exited.
void CodeCompletePreprocessorMacroName(bool IsDefinition)
NestedNameSpecifierLoc SubstNestedNameSpecifierLoc(NestedNameSpecifierLoc NNS, const MultiLevelTemplateArgumentList &TemplateArgs)
void RecordParsingTemplateParameterDepth(unsigned Depth)
This is used to inform Sema what the current TemplateParameterDepth is during Parsing.
Definition Sema.cpp:2097
ExprResult ActOnVAArg(SourceLocation BuiltinLoc, Expr *E, ParsedType Ty, SourceLocation RPLoc)
OMPClause * ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'num_tasks' clause.
MemInitResult BuildMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, Expr *Init, SourceLocation EllipsisLoc)
Handle a C++ member initializer.
void ActOnAfterCompoundStatementLeadingPragmas()
Definition SemaStmt.cpp:393
TypeSourceInfo * GetTypeForDeclaratorCast(Declarator &D, QualType FromTy)
StmtResult ActOnDeclStmt(DeclGroupPtrTy Decl, SourceLocation StartLoc, SourceLocation EndLoc)
Definition SemaStmt.cpp:73
bool RequireCompleteType(SourceLocation Loc, QualType T, CompleteTypeKind Kind, TypeDiagnoser &Diagnoser)
Ensure that the type T is a complete type.
void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D, SourceLocation LocAfterDecls)
void DiagnoseUseOfUnimplementedSelectors()
Scope * TUScope
Translation Unit Scope - useful to Objective-C actions that need to lookup file scope declarations in...
Definition Sema.h:1124
ReferenceCompareResult CompareReferenceRelationship(SourceLocation Loc, QualType T1, QualType T2, ReferenceConversions *Conv=nullptr)
CompareReferenceRelationship - Compare the two types T1 and T2 to determine whether they are referenc...
void ActOnTagFinishSkippedDefinition(SkippedDefinitionContext Context)
PartialDiagnostic PDiag(unsigned DiagID=0)
Build a partial diagnostic.
bool EnsureTemplateArgumentListConstraints(TemplateDecl *Template, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange)
Ensure that the given template arguments satisfy the constraints associated with the given template,...
void DiagnoseUnterminatedPragmaAttribute()
void FreeVisContext()
FreeVisContext - Deallocate and null out VisContext.
ExprResult forceUnknownAnyToType(Expr *E, QualType ToType)
Force an expression with unknown-type to an expression of the given type.
void CodeCompleteOrdinaryName(Scope *S, ParserCompletionContext CompletionContext)
LateTemplateParserCB * LateTemplateParser
Definition Sema.h:916
void DiagnoseAmbiguousLookup(LookupResult &Result)
Produce a diagnostic describing the ambiguity that resulted from name lookup.
StmtResult ActOnOpenMPTargetTeamsGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp target teams loop' after parsing of the associated statement.
void ActOnFields(Scope *S, SourceLocation RecLoc, Decl *TagDecl, ArrayRef< Decl * > Fields, SourceLocation LBrac, SourceLocation RBrac, const ParsedAttributesView &AttrList)
bool LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, bool InUnqualifiedLookup=false)
Perform qualified name lookup into a given context.
void NoteDeletedInheritingConstructor(CXXConstructorDecl *CD)
ExprResult ActOnCastExpr(Scope *S, SourceLocation LParenLoc, Declarator &D, ParsedType &Ty, SourceLocation RParenLoc, Expr *CastExpr)
void ModifyFnAttributesMSPragmaOptimize(FunctionDecl *FD)
Only called on function definitions; if there is a MSVC #pragma optimize in scope,...
LazyVector< CXXConstructorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadDelegatingConstructors, 2, 2 > DelegatingCtorDeclsType
Definition Sema.h:888
bool isEmptyCudaConstructor(SourceLocation Loc, CXXConstructorDecl *CD)
Definition SemaCUDA.cpp:463
void PopPragmaVisibility(bool IsNamespaceEnd, SourceLocation EndLoc)
PopPragmaVisibility - Pop the top element of the visibility stack; used for '#pragma GCC visibility' ...
bool CheckTemplateArgumentList(TemplateDecl *Template, SourceLocation TemplateLoc, TemplateArgumentListInfo &TemplateArgs, bool PartialTemplateArgs, SmallVectorImpl< TemplateArgument > &Converted, bool UpdateArgsWithConversions=true, bool *ConstraintsNotSatisfied=nullptr)
Check that the given template arguments can be be provided to the given template, converting the argu...
llvm::MapVector< FieldDecl *, DeleteLocs > DeleteExprs
Definition Sema.h:852
bool shouldLinkDependentDeclWithPrevious(Decl *D, Decl *OldDecl)
Checks if the new declaration declared in dependent context must be put in the same redeclaration cha...
TentativeDefinitionsType TentativeDefinitions
All the tentative definitions encountered in the TU.
Definition Sema.h:873
ObjCPropertyDecl * CreatePropertyDecl(Scope *S, ObjCContainerDecl *CDecl, SourceLocation AtLoc, SourceLocation LParenLoc, FieldDeclarator &FD, Selector GetterSel, SourceLocation GetterNameLoc, Selector SetterSel, SourceLocation SetterNameLoc, const bool isReadWrite, const unsigned Attributes, const unsigned AttributesAsWritten, QualType T, TypeSourceInfo *TSI, tok::ObjCKeywordKind MethodImplKind, DeclContext *lexicalDC=nullptr)
Called by ActOnProperty and HandlePropertyInClassExtension to handle creating the ObjcPropertyDecl fo...
void CodeCompleteObjCPropertyFlags(Scope *S, ObjCDeclSpec &ODS)
ExprResult BuildPredefinedExpr(SourceLocation Loc, PredefinedExpr::IdentKind IK)
Expr * MaybeCreateExprWithCleanups(Expr *SubExpr)
MaybeCreateExprWithCleanups - If the current full-expression requires any cleanups,...
OMPClause * ActOnOpenMPReadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'read' clause.
ExprResult BuildObjCSubscriptExpression(SourceLocation RB, Expr *BaseExpr, Expr *IndexExpr, ObjCMethodDecl *getterMethod, ObjCMethodDecl *setterMethod)
Build an ObjC subscript pseudo-object expression, given that that's supported by the runtime.
void CodeCompleteObjCPropertyGetter(Scope *S)
bool DeferDiags
Whether deferrable diagnostics should be deferred.
Definition Sema.h:1851
void checkInitializerLifetime(const InitializedEntity &Entity, Expr *Init)
Check that the lifetime of the initializer (and its subobjects) is sufficient for initializing the en...
QualType getLambdaConversionFunctionResultType(const FunctionProtoType *CallOpType, CallingConv CC)
Get the return type to use for a lambda's conversion function(s) to function pointer type,...
StmtResult ActOnOpenMPTaskLoopSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop simd' after parsing of the associated statement.
IdentifierInfo * getNSErrorIdent()
Retrieve the identifier "NSError".
bool RebuildingImmediateInvocation
Whether the AST is currently being rebuilt to correct immediate invocations.
Definition Sema.h:1035
DarwinSDKInfo * getDarwinSDKInfoForAvailabilityChecking()
Definition Sema.cpp:73
void DiagnoseAvailabilityOfDecl(NamedDecl *D, ArrayRef< SourceLocation > Locs, const ObjCInterfaceDecl *UnknownObjCClass, bool ObjCPropertyAccess, bool AvoidPartialAvailabilityChecks=false, ObjCInterfaceDecl *ClassReceiver=nullptr)
StmtResult ActOnOpenMPSectionsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp sections' after parsing of the associated statement.
ResultTypeCompatibilityKind
Describes the compatibility of a result type with its method.
Definition Sema.h:10234
@ RTC_Incompatible
Definition Sema.h:10236
@ RTC_Compatible
Definition Sema.h:10235
@ RTC_Unknown
Definition Sema.h:10237
void StartOpenMPDSABlock(OpenMPDirectiveKind K, const DeclarationNameInfo &DirName, Scope *CurScope, SourceLocation Loc)
Called on start of new data sharing attribute block.
const llvm::MapVector< FieldDecl *, DeleteLocs > & getMismatchingDeleteExpressions() const
Retrieves list of suspicious delete-expressions that will be checked at the end of translation unit.
Definition Sema.cpp:2647
void CheckCompletedCXXClass(Scope *S, CXXRecordDecl *Record)
Perform semantic checks on a class definition that has been completing, introducing implicitly-declar...
void DiscardCleanupsInEvaluationContext()
void ReadMethodPool(Selector Sel)
Read the contents of the method pool for a given selector from external storage.
SmallVector< ExpressionEvaluationContextRecord, 8 > ExprEvalContexts
A stack of expression evaluation contexts.
Definition Sema.h:1366
void PushDeclContext(Scope *S, DeclContext *DC)
Set the current declaration context until it gets popped.
StmtResult ActOnOpenMPParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for' after parsing of the associated statement.
bool CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New)
bool CheckVectorCast(SourceRange R, QualType VectorTy, QualType Ty, CastKind &Kind)
bool LookupTemplateName(LookupResult &R, Scope *S, CXXScopeSpec &SS, QualType ObjectType, bool EnteringContext, bool &MemberOfUnknownSpecialization, RequiredTemplateKind RequiredTemplate=SourceLocation(), AssumedTemplateKind *ATK=nullptr, bool AllowTypoCorrection=true)
void makeMergedDefinitionVisible(NamedDecl *ND)
Make a merged definition of an existing hidden definition ND visible at the specified location.
void makeModuleVisible(Module *Mod, SourceLocation ImportLoc)
Definition Sema.h:2312
bool isOpenMPCapturedByRef(const ValueDecl *D, unsigned Level, unsigned OpenMPCaptureLevel) const
Return true if the provided declaration VD should be captured by reference.
QualType getCompletedType(Expr *E)
Get the type of expression E, triggering instantiation to complete the type if necessary – that is,...
StmtResult ActOnAttributedStmt(const ParsedAttributes &AttrList, Stmt *SubStmt)
Definition SemaStmt.cpp:599
UuidAttr * mergeUuidAttr(Decl *D, const AttributeCommonInfo &CI, StringRef UuidAsWritten, MSGuidDecl *GuidDecl)
bool isDependentScopeSpecifier(const CXXScopeSpec &SS)
SourceManager & SourceMgr
Definition Sema.h:412
MemberExpr * BuildMemberExpr(Expr *Base, bool IsArrow, SourceLocation OpLoc, const CXXScopeSpec *SS, SourceLocation TemplateKWLoc, ValueDecl *Member, DeclAccessPair FoundDecl, bool HadMultipleCandidates, const DeclarationNameInfo &MemberNameInfo, QualType Ty, ExprValueKind VK, ExprObjectKind OK, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateNameIsRequiredTag
Definition Sema.h:7735
@ TemplateNameIsRequired
Definition Sema.h:7735
bool CheckDestructor(CXXDestructorDecl *Destructor)
CheckDestructor - Checks a fully-formed destructor definition for well-formedness,...
ExprResult BuildVectorLiteral(SourceLocation LParenLoc, SourceLocation RParenLoc, Expr *E, TypeSourceInfo *TInfo)
Build an altivec or OpenCL literal.
NamedDecl * BuildUsingPackDecl(NamedDecl *InstantiatedFrom, ArrayRef< NamedDecl * > Expansions)
MemInitResult ActOnMemInitializer(Decl *ConstructorD, Scope *S, CXXScopeSpec &SS, IdentifierInfo *MemberOrBase, ParsedType TemplateTypeTy, const DeclSpec &DS, SourceLocation IdLoc, SourceLocation LParenLoc, ArrayRef< Expr * > Args, SourceLocation RParenLoc, SourceLocation EllipsisLoc)
Handle a C++ member initializer using parentheses syntax.
ExprResult ActOnSizeofParameterPackExpr(Scope *S, SourceLocation OpLoc, IdentifierInfo &Name, SourceLocation NameLoc, SourceLocation RParenLoc)
Called when an expression computing the size of a parameter pack is parsed.
void checkRetainCycles(ObjCMessageExpr *msg)
checkRetainCycles - Check whether an Objective-C message send might create an obvious retain cycle.
bool isUnavailableAlignedAllocationFunction(const FunctionDecl &FD) const
Determine whether FD is an aligned allocation or deallocation function that is unavailable.
bool hasReachableExplicitSpecialization(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine if there is a reachable declaration of D that is an explicit specialization declaration for...
StmtResult ActOnOpenMPTeamsDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp teams' after parsing of the associated statement.
Decl * BuildMicrosoftCAnonymousStruct(Scope *S, DeclSpec &DS, RecordDecl *Record)
BuildMicrosoftCAnonymousStruct - Handle the declaration of an Microsoft C anonymous structure.
TypeSourceInfo * SubstAutoTypeSourceInfo(TypeSourceInfo *TypeWithAuto, QualType Replacement)
Substitute Replacement for auto in TypeWithAuto.
void addAMDGPUFlatWorkGroupSizeAttr(Decl *D, const AttributeCommonInfo &CI, Expr *Min, Expr *Max)
addAMDGPUFlatWorkGroupSizeAttr - Adds an amdgpu_flat_work_group_size attribute to a particular declar...
void ActOnPragmaPack(SourceLocation PragmaLoc, PragmaMsStackAction Action, StringRef SlotLabel, Expr *Alignment)
ActOnPragmaPack - Called on well formed #pragma pack(...).
Definition SemaAttr.cpp:321
void ActOnStartDelayedCXXMethodDeclaration(Scope *S, Decl *Method)
ActOnStartDelayedCXXMethodDeclaration - We have completed parsing a top-level (non-nested) C++ class,...
OMPClause * ActOnOpenMPPartialClause(Expr *FactorExpr, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'partial' clauses.
LabelDecl * GetOrCreateMSAsmLabel(StringRef ExternalLabelName, SourceLocation Location, bool AlwaysCreate)
DiagnosticsEngine & Diags
Definition Sema.h:411
void CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, bool AllowNonIdentifiers, bool AllowNestedNameSpecifiers)
void DiagnoseUnterminatedPragmaAlignPack()
Definition SemaAttr.cpp:474
StmtResult ActOnBreakStmt(SourceLocation BreakLoc, Scope *CurScope)
FullExprArg MakeFullDiscardedValueExpr(Expr *Arg)
Definition Sema.h:4885
OpenCLOptions & getOpenCLOptions()
Definition Sema.h:1619
FPOptions CurFPFeatures
Definition Sema.h:405
void ActOnStartSEHFinallyBlock()
void AddParameterABIAttr(Decl *D, const AttributeCommonInfo &CI, ParameterABI ABI)
CXXConstructorDecl * DeclareImplicitCopyConstructor(CXXRecordDecl *ClassDecl)
Declare the implicit copy constructor for the given class.
bool DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CorrectionCandidateCallback &CCC, TemplateArgumentListInfo *ExplicitTemplateArgs=nullptr, ArrayRef< Expr * > Args=None, TypoExpr **Out=nullptr)
Diagnose an empty lookup.
OMPClause * ActOnOpenMPSafelenClause(Expr *Length, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'safelen' clause.
NamespaceDecl * getStdNamespace() const
ExprResult BuildEmptyCXXFoldExpr(SourceLocation EllipsisLoc, BinaryOperatorKind Operator)
RedeclarationKind forRedeclarationInCurContext()
Definition Sema.h:4228
void DeclareImplicitEqualityComparison(CXXRecordDecl *RD, FunctionDecl *Spaceship)
ExprResult BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope)
bool AttachBaseSpecifiers(CXXRecordDecl *Class, MutableArrayRef< CXXBaseSpecifier * > Bases)
Performs the actual work of attaching the given base class specifiers to a C++ class.
void ActOnCXXExitDeclInitializer(Scope *S, Decl *Dcl)
ActOnCXXExitDeclInitializer - Invoked after we are finished parsing an initializer for the declaratio...
NamedDecl * ActOnTypedefDeclarator(Scope *S, Declarator &D, DeclContext *DC, TypeSourceInfo *TInfo, LookupResult &Previous)
void CodeCompleteAfterFunctionEquals(Declarator &D)
ExprResult DefaultFunctionArrayConversion(Expr *E, bool Diagnose=true)
DefaultFunctionArrayConversion (C99 6.3.2.1p3, C99 6.3.2.1p4).
Definition SemaExpr.cpp:502
PragmaStack< StringLiteral * > DataSegStack
Definition Sema.h:689
LazyVector< const DeclaratorDecl *, ExternalSemaSource, &ExternalSemaSource::ReadUnusedFileScopedDecls, 2, 2 > UnusedFileScopedDeclsType
Definition Sema.h:880
void deduceClosureReturnType(sema::CapturingScopeInfo &CSI)
Deduce a block or lambda's return type based on the return statements present in the body.
LateTemplateParserCleanupCB * LateTemplateParserCleanup
Definition Sema.h:917
SmallVector< CXXMethodDecl *, 4 > DelayedDllExportMemberFunctions
Definition Sema.h:13408
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType)
Are the two types lax-compatible vector types? That is, given that one of them is a vector,...
NamedDecl * ActOnNonTypeTemplateParameter(Scope *S, Declarator &D, unsigned Depth, unsigned Position, SourceLocation EqualLoc, Expr *DefaultArg)
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD, ObjCMethodDecl *Getter, SourceLocation Loc)
@ TUK_Definition
Definition Sema.h:3234
@ TUK_Declaration
Definition Sema.h:3233
@ TUK_Friend
Definition Sema.h:3235
@ TUK_Reference
Definition Sema.h:3232
ExprResult PerformCopyInitialization(const InitializedEntity &Entity, SourceLocation EqualLoc, ExprResult Init, bool TopLevelOfInitList=false, bool AllowExplicit=false)
static bool adjustContextForLocalExternDecl(DeclContext *&DC)
Adjust the DeclContext for a function or variable that might be a function-local external declaration...
void diagnoseMissingTemplateArguments(TemplateName Name, SourceLocation Loc)
void CheckFunctionOrTemplateParamDeclarator(Scope *S, Declarator &D)
Common checks for a parameter-declaration that should apply to both function parameters and non-type ...
ExprResult ActOnTypeTrait(TypeTrait Kind, SourceLocation KWLoc, ArrayRef< ParsedType > Args, SourceLocation RParenLoc)
Parsed one of the type trait support pseudo-functions.
TemplateParamListContext
The context in which we are checking a template parameter list.
Definition Sema.h:7881
@ TPC_ClassTemplate
Definition Sema.h:7882
@ TPC_FriendFunctionTemplate
Definition Sema.h:7887
@ TPC_ClassTemplateMember
Definition Sema.h:7885
@ TPC_FunctionTemplate
Definition Sema.h:7884
@ TPC_FriendClassTemplate
Definition Sema.h:7886
@ TPC_FriendFunctionTemplateDefinition
Definition Sema.h:7888
@ TPC_TypeAliasTemplate
Definition Sema.h:7889
@ TPC_VarTemplate
Definition Sema.h:7883
void ActOnPragmaVisibility(const IdentifierInfo *VisType, SourceLocation PragmaLoc)
ActOnPragmaVisibility - Called on well formed #pragma GCC visibility... .
void ActOnAbortSEHFinallyBlock()
NamedDecl * ActOnTypedefNameDecl(Scope *S, DeclContext *DC, TypedefNameDecl *D, LookupResult &Previous, bool &Redeclaration)
ActOnTypedefNameDecl - Perform semantic checking for a declaration which declares a typedef-name,...
void ActOnFinishDelayedAttribute(Scope *S, Decl *D, ParsedAttributes &Attrs)
ActOnFinishDelayedAttribute - Invoked when we have finished parsing an attribute for which parsing is...
bool CheckQualifiedFunctionForTypeId(QualType T, SourceLocation Loc)
ExprResult BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field)
Decl * ActOnEmptyDeclaration(Scope *S, const ParsedAttributesView &AttrList, SourceLocation SemiLoc)
Handle a C++11 empty-declaration and attribute-declaration.
void CodeCompleteObjCAtStatement(Scope *S)
void DiagnoseAssignmentAsCondition(Expr *E)
DiagnoseAssignmentAsCondition - Given that an expression is being used as a boolean condition,...
SourceLocation OptimizeOffPragmaLocation
This represents the last location of a "#pragma clang optimize off" directive if such a directive has...
Definition Sema.h:758
bool isEmptyCudaDestructor(SourceLocation Loc, CXXDestructorDecl *CD)
Definition SemaCUDA.cpp:501
ExprResult getOpenMPCapturedExpr(VarDecl *Capture, ExprValueKind VK, ExprObjectKind OK, SourceLocation Loc)
StmtResult ActOnOpenMPAtomicDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp atomic' after parsing of the associated statement.
void checkSpecializationVisibility(SourceLocation Loc, NamedDecl *Spec)
We've found a use of a templated declaration that would trigger an implicit instantiation.
std::pair< SourceLocation, bool > DeleteExprLoc
Delete-expressions to be analyzed at the end of translation unit.
Definition Sema.h:850
void DiagnoseUnusedDecl(const NamedDecl *ND)
DiagnoseUnusedDecl - Emit warnings about declarations that are not used unless they are marked attr(u...
void handleDelayedAvailabilityCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
friend class ArgumentPackSubstitutionRAII
Definition Sema.h:9188
bool hasAcceptableDefaultArgument(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules, Sema::AcceptableKind Kind)
Determine if the template parameter D has a reachable default argument.
QualType BuildReadPipeType(QualType T, SourceLocation Loc)
Build a Read-only Pipe type.
void EmitRelatedResultTypeNote(const Expr *E)
If the given expression involves a message send to a method with a related result type,...
void PopDeclContext()
DeclGroupPtrTy ActOnForwardProtocolDeclaration(SourceLocation AtProtoclLoc, ArrayRef< IdentifierLocPair > IdentList, const ParsedAttributesView &attrList)
ActOnForwardProtocolDeclaration - Handle @protocol foo;.
void CodeCompleteObjCInterfaceDecl(Scope *S)
bool ActOnCXXEnterDeclaratorScope(Scope *S, CXXScopeSpec &SS)
ActOnCXXEnterDeclaratorScope - Called when a C++ scope specifier (global scope or nested-name-specifi...
ObjCMethodDecl * tryCaptureObjCSelf(SourceLocation Loc)
Try to capture an implicit reference to 'self'.
void EndOpenMPDSABlock(Stmt *CurDirective)
Called on end of data sharing attribute block.
TemplateArgumentLoc getIdentityTemplateArgumentLoc(NamedDecl *Param, SourceLocation Location)
Get a template argument mapping the given template parameter to itself, e.g.
bool isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType)
Determine whether this is an Objective-C writeback conversion, used for parameter passing when perfor...
void diagnoseIgnoredQualifiers(unsigned DiagID, unsigned Quals, SourceLocation FallbackLoc, SourceLocation ConstQualLoc=SourceLocation(), SourceLocation VolatileQualLoc=SourceLocation(), SourceLocation RestrictQualLoc=SourceLocation(), SourceLocation AtomicQualLoc=SourceLocation(), SourceLocation UnalignedQualLoc=SourceLocation())
AccessResult CheckMemberAccess(SourceLocation UseLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found)
Checks access to a member.
OMPClause * ActOnOpenMPNogroupClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'nogroup' clause.
void DiagnoseDuplicateIvars(ObjCInterfaceDecl *ID, ObjCInterfaceDecl *SID)
DiagnoseDuplicateIvars - Check for duplicate ivars in the entire class at the start of @implementatio...
QualType CheckBitwiseOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
concepts::NestedRequirement * BuildNestedRequirement(Expr *E)
llvm::MapVector< NamedDecl *, SourceLocation > UndefinedButUsed
UndefinedInternals - all the used, undefined objects which require a definition in this translation u...
Definition Sema.h:1457
void PrintStats() const
Print out statistics about the semantic analysis.
Definition Sema.cpp:562
ExprResult ActOnStmtExpr(Scope *S, SourceLocation LPLoc, Stmt *SubStmt, SourceLocation RPLoc)
StmtResult ActOnOpenMPParallelDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp parallel' after parsing of the associated statement.
bool CheckObjCDeclScope(Decl *D)
Checks that the Objective-C declaration is declared in the global scope.
QualType CheckConstructorDeclarator(Declarator &D, QualType R, StorageClass &SC)
CheckConstructorDeclarator - Called by ActOnDeclarator to check the well-formedness of the constructo...
ExprResult ConvertParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg, SourceLocation EqualLoc)
void ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD)
ProcessDeclAttributes - Given a declarator (PD) with attributes indicated in it, apply them to D.
MultiLevelTemplateArgumentList getTemplateInstantiationArgs(const NamedDecl *D, const TemplateArgumentList *Innermost=nullptr, bool RelativeToPrimary=false, const FunctionDecl *Pattern=nullptr)
Retrieve the template argument list(s) that should be used to instantiate the definition of the given...
static unsigned getPrintable(unsigned I)
Definition Sema.h:2143
void checkVariadicArgument(const Expr *E, VariadicCallType CT)
Check to see if the given expression is a valid argument to a variadic function, issuing a diagnostic...
Definition SemaExpr.cpp:968
ExprResult ActOnCXXFoldExpr(Scope *S, SourceLocation LParenLoc, Expr *LHS, tok::TokenKind Operator, SourceLocation EllipsisLoc, Expr *RHS, SourceLocation RParenLoc)
Handle a C++1z fold-expression: ( expr op ... op expr ).
void CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr)
CheckStaticArrayArgument - If the given argument corresponds to a static array parameter,...
@ FST_NSString
Definition Sema.h:13187
@ FST_Unknown
Definition Sema.h:13194
@ FST_Strftime
Definition Sema.h:13188
@ FST_FreeBSDKPrintf
Definition Sema.h:13191
@ FST_Strfmon
Definition Sema.h:13189
@ FST_Kprintf
Definition Sema.h:13190
@ FST_OSTrace
Definition Sema.h:13192
LangOptions::PragmaMSPointersToMembersKind MSPointerToMemberRepresentationMethod
Controls member pointer representation format under the MS ABI.
Definition Sema.h:435
QualType SubstAutoTypeDependent(QualType TypeWithAuto)
void FilterLookupForScope(LookupResult &R, DeclContext *Ctx, Scope *S, bool ConsiderLinkage, bool AllowInlineNamespace)
Filters out lookup results that don't fall within the given scope as determined by isDeclInScope.
void DeclApplyPragmaWeak(Scope *S, NamedDecl *ND, const WeakInfo &W)
DeclApplyPragmaWeak - A declaration (maybe definition) needs #pragma weak applied to it,...
QualType CheckSizelessVectorCompareOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, BinaryOperatorKind Opc)
FunctionDecl * FindDeallocationFunctionForDestructor(SourceLocation StartLoc, CXXRecordDecl *RD)
llvm::BumpPtrAllocator BumpAlloc
Definition Sema.h:1434
QualType BuildObjCTypeParamType(const ObjCTypeParamDecl *Decl, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C type parameter type.
bool DiagnoseConditionalForNull(Expr *LHSExpr, Expr *RHSExpr, SourceLocation QuestionLoc)
Emit a specialized diagnostic when one expression is a null pointer constant and the other is not a p...
QualType BuildWritePipeType(QualType T, SourceLocation Loc)
Build a Write-only Pipe type.
void AddSurrogateCandidate(CXXConversionDecl *Conversion, DeclAccessPair FoundDecl, CXXRecordDecl *ActingContext, const FunctionProtoType *Proto, Expr *Object, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet)
AddSurrogateCandidate - Adds a "surrogate" candidate function that converts the given Object to a fun...
StmtResult ActOnOpenMPTileDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp tile' after parsing of its clauses and the associated statement.
QualType BuildObjCObjectType(QualType BaseType, SourceLocation Loc, SourceLocation TypeArgsLAngleLoc, ArrayRef< TypeSourceInfo * > TypeArgs, SourceLocation TypeArgsRAngleLoc, SourceLocation ProtocolLAngleLoc, ArrayRef< ObjCProtocolDecl * > Protocols, ArrayRef< SourceLocation > ProtocolLocs, SourceLocation ProtocolRAngleLoc, bool FailOnError=false)
Build an Objective-C object pointer type.
bool CheckConstraintSatisfaction(const NamedDecl *Template, ArrayRef< const Expr * > ConstraintExprs, ArrayRef< TemplateArgument > TemplateArgs, SourceRange TemplateIDRange, ConstraintSatisfaction &Satisfaction)
Check whether the given list of constraint expressions are satisfied (as if in a 'conjunction') given...
ExprResult BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number)
BuildObjCNumericLiteral - builds an ObjCBoxedExpr AST node for the numeric literal expression.
BuildForRangeKind
Definition Sema.h:4990
@ BFRK_Check
Determining whether a for-range statement could be built.
Definition Sema.h:4998
@ BFRK_Build
Initial building of a for-range statement.
Definition Sema.h:4992
@ BFRK_Rebuild
Instantiation or recovery rebuild of a for-range statement.
Definition Sema.h:4995
bool resolveAssumedTemplateNameAsType(Scope *S, TemplateName &Name, SourceLocation NameLoc, bool Diagnose=true)
SmallVector< Module *, 16 > CodeSynthesisContextLookupModules
Extra modules inspected when performing a lookup during a template instantiation.
Definition Sema.h:9113
Expr * FixOverloadedFunctionReference(Expr *E, DeclAccessPair FoundDecl, FunctionDecl *Fn)
FixOverloadedFunctionReference - E is an expression that refers to a C++ overloaded function (possibl...
CodeCompleteConsumer * CodeCompleter
Code-completion consumer.
Definition Sema.h:418
StmtResult ActOnCXXCatchBlock(SourceLocation CatchLoc, Decl *ExDecl, Stmt *HandlerBlock)
ActOnCXXCatchBlock - Takes an exception declaration and a handler block and creates a proper catch ha...
StmtResult ActOnOpenMPParallelGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel loop' after parsing of the associated statement.
void ActOnUninitializedDecl(Decl *dcl)
Decl * ActOnTemplatedFriendTag(Scope *S, SourceLocation FriendLoc, unsigned TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, MultiTemplateParamsArg TempParamLists)
Handle a friend tag declaration where the scope specifier was templated.
void checkNonTrivialCUnionInInitializer(const Expr *Init, SourceLocation Loc)
Emit diagnostics if the initializer or any of its explicit or implicitly-generated subexpressions req...
static Scope * getScopeForDeclContext(Scope *S, DeclContext *DC)
Finds the scope corresponding to the given decl context, if it happens to be an enclosing scope.
TypedefDecl * ParseTypedefDecl(Scope *S, Declarator &D, QualType T, TypeSourceInfo *TInfo)
Subroutines of ActOnDeclarator().
ExprResult CheckConceptTemplateId(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, const DeclarationNameInfo &ConceptNameInfo, NamedDecl *FoundDecl, ConceptDecl *NamedConcept, const TemplateArgumentListInfo *TemplateArgs)
StmtResult ActOnOpenMPTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp taskloop' after parsing of the associated statement.
sema::LambdaScopeInfo * getEnclosingLambda() const
Get the innermost lambda enclosing the current location, if any.
Definition Sema.cpp:2287
void ActOnCaseStmtBody(Stmt *CaseStmt, Stmt *SubStmt)
ActOnCaseStmtBody - This installs a statement as the body of a case.
Definition SemaStmt.cpp:535
ExprResult ActOnBlockStmtExpr(SourceLocation CaretLoc, Stmt *Body, Scope *CurScope)
ActOnBlockStmtExpr - This is called when the body of a block statement literal was successfully compl...
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit)
AddInitializerToDecl - Adds the initializer Init to the declaration dcl.
void ActOnModuleEnd(SourceLocation DirectiveLoc, Module *Mod)
The parser has left a submodule.
bool isUsualDeallocationFunction(const CXXMethodDecl *FD)
PragmaSectionKind
Definition Sema.h:10298
@ PSK_ConstSeg
Definition Sema.h:10301
@ PSK_DataSeg
Definition Sema.h:10299
@ PSK_CodeSeg
Definition Sema.h:10302
StmtResult ActOnOpenMPTeamsDistributeSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute simd' after parsing of the associated statement.
void CheckConceptRedefinition(ConceptDecl *NewDecl, LookupResult &Previous, bool &AddToScope)
OMPClause * ActOnOpenMPFromClause(ArrayRef< OpenMPMotionModifierKind > MotionModifiers, ArrayRef< SourceLocation > MotionModifiersLoc, CXXScopeSpec &MapperIdScopeSpec, DeclarationNameInfo &MapperId, SourceLocation ColonLoc, ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs, ArrayRef< Expr * > UnresolvedMappers=llvm::None)
Called on well-formed 'from' clause.
void DiagnoseDeletedDefaultedFunction(FunctionDecl *FD)
Produce notes explaining why a defaulted function was defined as deleted.
OMPClause * ActOnOpenMPLastprivateClause(ArrayRef< Expr * > VarList, OpenMPLastprivateModifier LPKind, SourceLocation LPKindLoc, SourceLocation ColonLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'lastprivate' clause.
ExprResult BuildArrayTypeTrait(ArrayTypeTrait ATT, SourceLocation KWLoc, TypeSourceInfo *TSInfo, Expr *DimExpr, SourceLocation RParen)
HLSLShaderAttr * mergeHLSLShaderAttr(Decl *D, const AttributeCommonInfo &AL, HLSLShaderAttr::ShaderType ShaderType)
void runWithSufficientStackSpace(SourceLocation Loc, llvm::function_ref< void()> Fn)
Run some code with "sufficient" stack space.
Definition Sema.cpp:506
void MarkMemberReferenced(MemberExpr *E)
Perform reference-marking and odr-use handling for a MemberExpr.
TypeSourceInfo * CheckPackExpansion(TypeSourceInfo *Pattern, SourceLocation EllipsisLoc, Optional< unsigned > NumExpansions)
Construct a pack expansion type from the pattern of the pack expansion.
void addExternalSource(ExternalSemaSource *E)
Registers an external source.
Definition Sema.cpp:545
ExprResult BuildCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, TypeSourceInfo *Ty, Expr *E, SourceRange AngleBrackets, SourceRange Parens)
Definition SemaCast.cpp:296
bool DiagnoseAssignmentResult(AssignConvertType ConvTy, SourceLocation Loc, QualType DstType, QualType SrcType, Expr *SrcExpr, AssignmentAction Action, bool *Complained=nullptr)
DiagnoseAssignmentResult - Emit a diagnostic, if required, for the assignment conversion type specifi...
bool CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionExceptionSpec - Checks whether the exception spec is a subset of base spec.
OMPClause * ActOnOpenMPReductionClause(ArrayRef< Expr * > VarList, OpenMPReductionClauseModifier Modifier, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'reduction' clause.
void ActOnOpenMPAssumesDirective(SourceLocation Loc, OpenMPDirectiveKind DKind, ArrayRef< std::string > Assumptions, bool SkippedClauses)
Called on well-formed '#pragma omp [begin] assume[s]'.
Decl * ActOnField(Scope *S, Decl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth)
ActOnField - Each field of a C struct/union is passed into this in order to create a FieldDecl object...
OMPClause * ActOnOpenMPSizesClause(ArrayRef< Expr * > SizeExprs, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-form 'sizes' clause.
FunctionDecl * getCurFunctionDecl(bool AllowLambda=false)
Returns a pointer to the innermost enclosing function, or nullptr if the current context is not insid...
Definition Sema.cpp:1440
bool CheckExplicitlyDefaultedSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM)
void MarkFunctionReferenced(SourceLocation Loc, FunctionDecl *Func, bool MightBeOdrUse=true)
Mark a function referenced, and check whether it is odr-used (C++ [basic.def.odr]p2,...
OMPClause * ActOnOpenMPOrderClause(OpenMPOrderClauseKind Kind, SourceLocation KindLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'order' clause.
bool RequireCompleteSizedType(SourceLocation Loc, QualType T, unsigned DiagID, const Ts &... Args)
Definition Sema.h:2453
ExprResult ActOnStmtExprResult(ExprResult E)
void EndOpenMPClause()
End analysis of clauses.
IdentifierInfo * InventAbbreviatedTemplateParameterTypeName(IdentifierInfo *ParamName, unsigned Index)
Invent a new identifier for parameters of abbreviated templates.
Definition Sema.cpp:90
void BuildVariableInstantiation(VarDecl *NewVar, VarDecl *OldVar, const MultiLevelTemplateArgumentList &TemplateArgs, LateInstantiatedAttrVec *LateAttrs, DeclContext *Owner, LocalInstantiationScope *StartingScope, bool InstantiatingVarTemplate=false, VarTemplateSpecializationDecl *PrevVTSD=nullptr)
BuildVariableInstantiation - Used after a new variable has been created.
ExprResult ActOnPostfixUnaryOp(Scope *S, SourceLocation OpLoc, tok::TokenKind Kind, Expr *Input)
void mergeObjCMethodDecls(ObjCMethodDecl *New, ObjCMethodDecl *Old)
bool CheckTemplateParameterList(TemplateParameterList *NewParams, TemplateParameterList *OldParams, TemplateParamListContext TPC, SkipBodyInfo *SkipBody=nullptr)
Checks the validity of a template parameter list, possibly considering the template parameter list fr...
bool DiagnoseSwiftName(Decl *D, StringRef Name, SourceLocation Loc, const ParsedAttr &AL, bool IsAsync)
Do a check to make sure Name looks like a legal argument for the swift_name attribute applied to decl...
void ActOnCXXForRangeDecl(Decl *D)
bool CheckOverridingFunctionReturnType(const CXXMethodDecl *New, const CXXMethodDecl *Old)
CheckOverridingFunctionReturnType - Checks whether the return types are covariant,...
bool isOpenMPRebuildMemberExpr(ValueDecl *D)
The member expression(this->fd) needs to be rebuilt in the template instantiation to generate private...
bool diagnoseQualifiedDeclaration(CXXScopeSpec &SS, DeclContext *DC, DeclarationName Name, SourceLocation Loc, bool IsTemplateId)
Diagnose a declaration whose declarator-id has the given nested-name-specifier.
bool GatherArgumentsForCall(SourceLocation CallLoc, FunctionDecl *FDecl, const FunctionProtoType *Proto, unsigned FirstParam, ArrayRef< Expr * > Args, SmallVectorImpl< Expr * > &AllArgs, VariadicCallType CallType=VariadicDoesNotApply, bool AllowExplicit=false, bool IsListInitialization=false)
GatherArgumentsForCall - Collector argument expressions for various form of call prototypes.
StmtResult ActOnOpenMPGenericLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp loop' after parsing of the associated statement.
std::tuple< MangleNumberingContext *, Decl * > getCurrentMangleNumberContext(const DeclContext *DC)
Compute the mangling number context for a lambda expression or block literal.
void ActOnPragmaFPReassociate(SourceLocation Loc, bool IsEnabled)
Called on well formed #pragma clang fp reassociate.
bool CheckConversionToObjCLiteral(QualType DstType, Expr *&SrcExpr, bool Diagnose=true)
QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc)
void DiagnoseEqualityWithExtraParens(ParenExpr *ParenE)
Redundant parentheses over an equality comparison can indicate that the user intended an assignment u...
bool isMoreSpecializedThanPrimary(ClassTemplatePartialSpecializationDecl *T, sema::TemplateDeductionInfo &Info)
llvm::MapVector< IdentifierInfo *, llvm::SetVector< WeakInfo, llvm::SmallVector< WeakInfo, 1u >, llvm::SmallDenseSet< WeakInfo, 2u, WeakInfo::DenseMapInfoByAliasOnly > > > WeakUndeclaredIdentifiers
WeakUndeclaredIdentifiers - Identifiers contained in #pragma weak before declared.
Definition Sema.h:1100
static bool isCUDAImplicitHostDeviceFunction(const FunctionDecl *D)
Definition SemaCUDA.cpp:266
ExprResult CreateRecoveryExpr(SourceLocation Begin, SourceLocation End, ArrayRef< Expr * > SubExprs, QualType T=QualType())
Attempts to produce a RecoveryExpr after some AST node cannot be created.
bool hasAcceptableDefinition(NamedDecl *D, NamedDecl **Suggested, AcceptableKind Kind, bool OnlyNeedComplete=false)
void CodeCompleteObjCImplementationCategory(Scope *S, IdentifierInfo *ClassName, SourceLocation ClassNameLoc)
llvm::SmallSet< SourceLocation, 2 > SrcLocSet
Definition Sema.h:9490
ExprResult HandleExprPropertyRefExpr(const ObjCObjectPointerType *OPT, Expr *BaseExpr, SourceLocation OpLoc, DeclarationName MemberName, SourceLocation MemberLoc, SourceLocation SuperLoc, QualType SuperType, bool Super)
HandleExprPropertyRefExpr - Handle foo.bar where foo is a pointer to an objective C interface.
ExprResult BuildBinOp(Scope *S, SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
PragmaClangSection PragmaClangBSSSection
Definition Sema.h:470
Decl * ActOnDeclarator(Scope *S, Declarator &D)
bool PopForceCUDAHostDevice()
Decrements our count of the number of times we've seen a pragma forcing functions to be host device.
Definition SemaCUDA.cpp:42
ExprResult ActOnNumericConstant(const Token &Tok, Scope *UDLScope=nullptr)
DeclarationName VAListTagName
VAListTagName - The declaration name corresponding to __va_list_tag.
Definition Sema.h:429
StmtResult ActOnObjCAtCatchStmt(SourceLocation AtLoc, SourceLocation RParen, Decl *Parm, Stmt *Body)
AbstractDiagSelID
Definition Sema.h:7683
@ AbstractSynthesizedIvarType
Definition Sema.h:7690
@ AbstractVariableType
Definition Sema.h:7687
@ AbstractReturnType
Definition Sema.h:7685
@ AbstractNone
Definition Sema.h:7684
@ AbstractFieldType
Definition Sema.h:7688
@ AbstractArrayType
Definition Sema.h:7691
@ AbstractParamType
Definition Sema.h:7686
@ AbstractIvarType
Definition Sema.h:7689
ExprResult PerformObjectMemberConversion(Expr *From, NestedNameSpecifier *Qualifier, NamedDecl *FoundDecl, NamedDecl *Member)
Cast a base object to a member's actual type.
StmtResult ActOnIfStmt(SourceLocation IfLoc, IfStatementKind StatementKind, SourceLocation LParenLoc, Stmt *InitStmt, ConditionResult Cond, SourceLocation RParenLoc, Stmt *ThenVal, SourceLocation ElseLoc, Stmt *ElseVal)
Definition SemaStmt.cpp:878
MSPropertyDecl * HandleMSProperty(Scope *S, RecordDecl *TagD, SourceLocation DeclStart, Declarator &D, Expr *BitfieldWidth, InClassInitStyle InitStyle, AccessSpecifier AS, const ParsedAttr &MSPropertyAttr)
HandleMSProperty - Analyze a __delcspec(property) field of a C++ class.
bool InstantiateEnum(SourceLocation PointOfInstantiation, EnumDecl *Instantiation, EnumDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs, TemplateSpecializationKind TSK)
Instantiate the definition of an enum from a given pattern.
ExprResult BuildInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
void CodeCompletePreprocessorDirective(bool InConditional)
TypeSourceInfo * GetTypeForDeclarator(Declarator &D, Scope *S)
GetTypeForDeclarator - Convert the type for the specified declarator to Type instances.
PragmaOptionsAlignKind
Definition Sema.h:10247
@ POAK_Packed
Definition Sema.h:10250
@ POAK_Mac68k
Definition Sema.h:10252
@ POAK_Natural
Definition Sema.h:10249
@ POAK_Native
Definition Sema.h:10248
StmtResult ActOnOpenMPTaskyieldDirective(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp taskyield'.
void ActOnBlockStart(SourceLocation CaretLoc, Scope *CurScope)
ActOnBlockStart - This callback is invoked when a block literal is started.
void UpdateExceptionSpec(FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI)
void CheckAlignasUnderalignment(Decl *D)
ExprResult ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, MultiExprArg ArgExprs, SourceLocation RLoc)
std::string getTemplateArgumentBindingsText(const TemplateParameterList *Params, const TemplateArgumentList &Args)
Produces a formatted string that describes the binding of template parameters to template arguments.
void HandleDelayedAccessCheck(sema::DelayedDiagnostic &DD, Decl *Ctx)
bool CheckRedeclarationInModule(NamedDecl *New, NamedDecl *Old)
OMPClause * ActOnOpenMPReverseOffloadClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'reverse_offload' clause.
LazyDeclPtr StdAlignValT
The C++ "std::align_val_t" enum class, which is defined by the C++ standard library.
Definition Sema.h:1135
ExprResult ActOnNameClassifiedAsDependentNonType(const CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, bool IsAddressOfOperand)
Act on the result of classifying a name as an undeclared member of a dependent base class.
Decl * ActOnObjCExceptionDecl(Scope *S, Declarator &D)
ExprResult CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr)
CreateBuiltinBinOp - Creates a new built-in binary operation with operator Opc at location TokLoc.
ExprResult BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, SourceLocation RParenLoc, MultiExprArg Args, AtomicExpr::AtomicOp Op, AtomicArgumentOrder ArgOrder=AtomicArgumentOrder::API)
void LateTemplateParserCB(void *P, LateParsedTemplate &LPT)
Callback to the parser to parse templated functions when needed.
Definition Sema.h:914
StmtResult ActOnOpenMPTeamsDistributeParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for simd' after parsing of the associate...
Decl * ActOnFinishExportDecl(Scope *S, Decl *ExportDecl, SourceLocation RBraceLoc)
Complete the definition of an export declaration.
ExprResult BuildClassMessageImplicit(QualType ReceiverType, bool isSuperReceiver, SourceLocation Loc, Selector Sel, ObjCMethodDecl *Method, MultiExprArg Args)
void finishLambdaExplicitCaptures(sema::LambdaScopeInfo *LSI)
Note that we have finished the explicit captures for the given lambda.
ObjCSubscriptKind
Definition Sema.h:3814
@ OS_Dictionary
Definition Sema.h:3816
bool checkTargetClonesAttrString(SourceLocation LiteralLoc, StringRef Str, const StringLiteral *Literal, bool &HasDefault, bool &HasCommas, SmallVectorImpl< StringRef > &Strings)
AssignConvertType CheckAssignmentConstraints(SourceLocation Loc, QualType LHSType, QualType RHSType)
CheckAssignmentConstraints - Perform type checking for assignment, argument passing,...
void DiagnoseUnsatisfiedConstraint(const ConstraintSatisfaction &Satisfaction, bool First=true)
Emit diagnostics explaining why a constraint expression was deemed unsatisfied.
void ActOnPragmaFPContract(SourceLocation Loc, LangOptions::FPModeKind FPC)
ActOnPragmaFPContract - Called on well formed #pragma {STDC,OPENCL} FP_CONTRACT and #pragma clang fp ...
SwiftNameAttr * mergeSwiftNameAttr(Decl *D, const SwiftNameAttr &SNA, StringRef Name)
ExprResult BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg, QualType ParamType, SourceLocation Loc)
Given a non-type template argument that refers to a declaration and the type of its corresponding non...
void SetDeclDeleted(Decl *dcl, SourceLocation DelLoc)
void ActOnPureSpecifier(Decl *D, SourceLocation PureSpecLoc)
bool IsDerivedFrom(SourceLocation Loc, QualType Derived, QualType Base)
Determine whether the type Derived is a C++ class that is derived from the type Base.
void ActOnPragmaOptimize(bool On, SourceLocation PragmaLoc)
Called on well formed #pragma clang optimize.
ExprResult ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, MultiExprArg ArgExprs, SourceLocation RParenLoc, Expr *ExecConfig=nullptr)
ActOnCallExpr - Handle a call to Fn with the specified array of arguments.
ExprResult ActOnUnaryExprOrTypeTraitExpr(SourceLocation OpLoc, UnaryExprOrTypeTrait ExprKind, bool IsType, void *TyOrEx, SourceRange ArgRange)
ActOnUnaryExprOrTypeTraitExpr - Handle sizeof(type) and sizeof expr and the same for alignof and __al...
QualType PreferredConditionType(ConditionKind K) const
Definition Sema.h:12454
ForRangeStatus BuildForRangeBeginEndCall(SourceLocation Loc, SourceLocation RangeLoc, const DeclarationNameInfo &NameInfo, LookupResult &MemberLookup, OverloadCandidateSet *CandidateSet, Expr *Range, ExprResult *CallExpr)
Build a call to 'begin' or 'end' for a C++11 for-range statement.
void clearDelayedTypo(TypoExpr *TE)
Clears the state of the given TypoExpr.
ObjCMessageKind
Describes the kind of message expression indicated by a message send that starts with an identifier.
Definition Sema.h:10114
@ ObjCSuperMessage
The message is sent to 'super'.
Definition Sema.h:10116
@ ObjCClassMessage
The message is a class message, and the identifier is a type name.
Definition Sema.h:10121
@ ObjCInstanceMessage
The message is an instance message.
Definition Sema.h:10118
LiteralOperatorLookupResult
The possible outcomes of name lookup for a literal operator.
Definition Sema.h:4240
@ LOLR_ErrorNoDiagnostic
The lookup found no match but no diagnostic was issued.
Definition Sema.h:4244
@ LOLR_Raw
The lookup found a single 'raw' literal operator, which expects a string literal containing the spell...
Definition Sema.h:4250
@ LOLR_Error
The lookup resulted in an error.
Definition Sema.h:4242
@ LOLR_Cooked
The lookup found a single 'cooked' literal operator, which expects a normal literal to be built and p...
Definition Sema.h:4247
@ LOLR_StringTemplatePack
The lookup found an overload set of literal operator templates, which expect the character type and c...
Definition Sema.h:4258
@ LOLR_Template
The lookup found an overload set of literal operator templates, which expect the characters of the sp...
Definition Sema.h:4254
OMPClause * ActOnOpenMPTaskReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'task_reduction' clause.
void ActOnPragmaWeakAlias(IdentifierInfo *WeakName, IdentifierInfo *AliasName, SourceLocation PragmaLoc, SourceLocation WeakNameLoc, SourceLocation AliasNameLoc)
ActOnPragmaWeakAlias - Called on well formed #pragma weak ident = ident.
sema::FunctionScopeInfo * getEnclosingFunction() const
Definition Sema.cpp:2275
void ActOnBlockArguments(SourceLocation CaretLoc, Declarator &ParamInfo, Scope *CurScope)
ActOnBlockArguments - This callback allows processing of block arguments.
StmtResult ActOnOpenMPMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp master taskloop' after parsing of the associated statement.
ExprResult SemaBuiltinShuffleVector(CallExpr *TheCall)
SemaBuiltinShuffleVector - Handle __builtin_shufflevector.
void CodeCompletePreprocessorExpression()
QualType CheckRemainderOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, bool IsCompAssign=false)
void CodeCompleteObjCForCollection(Scope *S, DeclGroupPtrTy IterationVar)
CheckConstexprKind
Definition Sema.h:2876
@ CheckValid
Identify whether this function satisfies the formal rules for constexpr functions in the current lanu...
@ Diagnose
Diagnose issues that are non-constant or that are extensions.
ExprResult ActOnClassPropertyRefExpr(IdentifierInfo &receiverName, IdentifierInfo &propertyName, SourceLocation receiverNameLoc, SourceLocation propertyNameLoc)
void CheckVariableDeclarationType(VarDecl *NewVD)
sema::CompoundScopeInfo & getCurCompoundScope() const
Definition SemaStmt.cpp:405
DeclContext * FindInstantiatedContext(SourceLocation Loc, DeclContext *DC, const MultiLevelTemplateArgumentList &TemplateArgs)
Finds the instantiation of the given declaration context within the current instantiation.
sema::CapturedRegionScopeInfo * getCurCapturedRegion()
Retrieve the current captured region, if any.
Definition Sema.cpp:2639
unsigned getTemplateDepth(Scope *S) const
Determine the number of levels of enclosing template parameters.
void warnStackExhausted(SourceLocation Loc)
Warn that the stack is nearly exhausted.
Definition Sema.cpp:498
DelayedDiagnosticsState ProcessingContextState
Definition Sema.h:935
bool CheckOpenMPLinearModifier(OpenMPLinearClauseKind LinKind, SourceLocation LinLoc)
Checks correctness of linear modifiers.
CXXSpecialMember
Kinds of C++ special members.
Definition Sema.h:1508
@ CXXCopyConstructor
Definition Sema.h:1510
@ CXXMoveConstructor
Definition Sema.h:1511
@ CXXDestructor
Definition Sema.h:1514
@ CXXDefaultConstructor
Definition Sema.h:1509
@ CXXInvalid
Definition Sema.h:1515
@ CXXMoveAssignment
Definition Sema.h:1513
@ CXXCopyAssignment
Definition Sema.h:1512
bool CanPerformCopyInitialization(const InitializedEntity &Entity, ExprResult Init)
SkippedDefinitionContext ActOnTagStartSkippedDefinition(Scope *S, Decl *TD)
Invoked when we enter a tag definition that we're skipping.
void diagnoseZeroToNullptrConversion(CastKind Kind, const Expr *E)
Warn when implicitly casting 0 to nullptr.
Definition Sema.cpp:585
bool CheckCXXThrowOperand(SourceLocation ThrowLoc, QualType ThrowTy, Expr *E)
CheckCXXThrowOperand - Validate the operand of a throw.
bool SetCtorInitializers(CXXConstructorDecl *Constructor, bool AnyErrors, ArrayRef< CXXCtorInitializer * > Initializers=None)
bool DeduceVariableDeclarationType(VarDecl *VDecl, bool DirectInit, Expr *Init)
std::string getCudaConfigureFuncName() const
Returns the name of the launch configuration function.
Definition SemaCUDA.cpp:952
void ActOnPragmaDump(Scope *S, SourceLocation Loc, IdentifierInfo *II)
Called on #pragma clang __debug dump II.
DeduceAutoResult
Result type of DeduceAutoType.
Definition Sema.h:8838
@ DAR_FailedAlreadyDiagnosed
Definition Sema.h:8841
@ DAR_Failed
Definition Sema.h:8840
@ DAR_Succeeded
Definition Sema.h:8839
bool LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation=false, bool ForceNoCPlusPlus=false)
Perform unqualified name lookup starting from a given scope.
void ActOnPragmaFEnvAccess(SourceLocation Loc, bool IsEnabled)
ActOnPragmaFenvAccess - Called on well formed #pragma STDC FENV_ACCESS.
bool SubstBaseSpecifiers(CXXRecordDecl *Instantiation, CXXRecordDecl *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
Perform substitution on the base class specifiers of the given class template specialization.
void LoadExternalVTableUses()
Load any externally-stored vtable uses.
SemaDiagnosticBuilder SYCLDiagIfDeviceCode(SourceLocation Loc, unsigned DiagID)
Creates a SemaDiagnosticBuilder that emits the diagnostic if the current context is "used as device c...
Definition SemaSYCL.cpp:21
static QualType GetTypeFromParser(ParsedType Ty, TypeSourceInfo **TInfo=nullptr)
ObjCMethodDecl * DictionaryWithObjectsMethod
The declaration of the dictionaryWithObjects:forKeys:count: method.
Definition Sema.h:1203
llvm::SmallPtrSet< const NamedDecl *, 4 > TypoCorrectedFunctionDefinitions
The function definitions which were renamed as part of typo-correction to match their respective decl...
Definition Sema.h:1548
void ActOnFinishOfCompoundStmt()
Definition SemaStmt.cpp:401
concepts::Requirement * ActOnNestedRequirement(Expr *Constraint)
QualType adjustCCAndNoReturn(QualType ArgFunctionType, QualType FunctionType, bool AdjustExceptionSpec=false)
Adjust the type ArgFunctionType to match the calling convention, noreturn, and optionally the excepti...
bool CheckForwardProtocolDeclarationForCircularDependency(IdentifierInfo *PName, SourceLocation &PLoc, SourceLocation PrevLoc, const ObjCList< ObjCProtocolDecl > &PList)
ExprResult ActOnObjCAvailabilityCheckExpr(llvm::ArrayRef< AvailabilitySpec > AvailSpecs, SourceLocation AtLoc, SourceLocation RParen)
TemplateDeductionResult FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, SmallVectorImpl< DeducedTemplateArgument > &Deduced, unsigned NumExplicitlySpecified, FunctionDecl *&Specialization, sema::TemplateDeductionInfo &Info, SmallVectorImpl< OriginalCallArg > const *OriginalCallArgs=nullptr, bool PartialOverloading=false, llvm::function_ref< bool()> CheckNonDependent=[]{ return false;})
Finish template argument deduction for a function template, checking the deduced template arguments f...
bool IsStringLiteralToNonConstPointerConversion(Expr *From, QualType ToType)
Helper function to determine whether this is the (deprecated) C++ conversion from a string literal to...
void ActOnOpenMPDeclareReductionCombinerEnd(Decl *D, Expr *Combiner)
Finish current declare reduction construct initializer.
Decl * ActOnUsingDirective(Scope *CurScope, SourceLocation UsingLoc, SourceLocation NamespcLoc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *NamespcName, const ParsedAttributesView &AttrList)
Decl * ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, SourceLocation KWLoc, CXXScopeSpec &SS, IdentifierInfo *Name, SourceLocation NameLoc, const ParsedAttributesView &Attr, AccessSpecifier AS, SourceLocation ModulePrivateLoc, MultiTemplateParamsArg TemplateParameterLists, bool &OwnedDecl, bool &IsDependent, SourceLocation ScopedEnumKWLoc, bool ScopedEnumUsesClassTag, TypeResult UnderlyingType, bool IsTypeSpecifier, bool IsTemplateParamOrArg, SkipBodyInfo *SkipBody=nullptr)
This is invoked when we see 'struct foo' or 'struct {'.
bool CheckExceptionSpecCompatibility(Expr *From, QualType ToType)
ExprResult ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, Scope *CurScope)
ActOnLambdaExpr - This is called when the body of a lambda expression was successfully completed.
void AddSectionMSAllocText(FunctionDecl *FD)
Only called on function definitions; if there is a #pragma alloc_text that decides which code section...
ExprResult CreateBuiltinUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, Expr *InputExpr)
void computeNRVO(Stmt *Body, sema::FunctionScopeInfo *Scope)
Given the set of return statements within a function body, compute the variables that are subject to ...
ObjCSpecialMethodKind
Definition Sema.h:10050
@ OSMK_NonRetainingInit
Definition Sema.h:10056
@ OSMK_RetainingInit
Definition Sema.h:10055
bool RequireCompleteExprType(Expr *E, unsigned DiagID, const Ts &...Args)
Definition Sema.h:2475
void AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E)
AddAlignValueAttr - Adds an align_value attribute to a particular declaration.
OMPClause * ActOnOpenMPDefaultmapClause(OpenMPDefaultmapClauseModifier M, OpenMPDefaultmapClauseKind Kind, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation MLoc, SourceLocation KindLoc, SourceLocation EndLoc)
Called on well-formed 'defaultmap' clause.
void checkNonTrivialCUnion(QualType QT, SourceLocation Loc, NonTrivialCUnionContext UseContext, unsigned NonTrivialKind)
Emit diagnostics if a non-trivial C union type or a struct that contains a non-trivial C union is use...
QualType CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, SourceLocation Loc, QualType *CompLHSTy=nullptr)
static ConditionResult ConditionError()
Definition Sema.h:12447
StmtResult ActOnCompoundStmt(SourceLocation L, SourceLocation R, ArrayRef< Stmt * > Elts, bool isStmtExpr)
Definition SemaStmt.cpp:409
StmtResult ActOnOpenMPCanonicalLoop(Stmt *AStmt)
Called for syntactical loops (ForStmt or CXXForRangeStmt) associated to an OpenMP loop directive.
ExprResult ActOnConvertVectorExpr(Expr *E, ParsedType ParsedDestTy, SourceLocation BuiltinLoc, SourceLocation RParenLoc)
__builtin_convertvector(...)
bool CheckNonDependentConversions(FunctionTemplateDecl *FunctionTemplate, ArrayRef< QualType > ParamTypes, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, ConversionSequenceList &Conversions, bool SuppressUserConversions, CXXRecordDecl *ActingContext=nullptr, QualType ObjectType=QualType(), Expr::Classification ObjectClassification={}, OverloadCandidateParamOrder PO={})
Check that implicit conversion sequences can be formed for each argument whose corresponding paramete...
void HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, QualType FromType, QualType ToType)
HandleFunctionTypeMismatch - Gives diagnostic information for differeing function types.
void ActOnStartTrailingRequiresClause(Scope *S, Declarator &D)
const NormalizedConstraint * getNormalizedAssociatedConstraints(NamedDecl *ConstrainedDecl, ArrayRef< const Expr * > AssociatedConstraints)
StmtResult ActOnOpenMPParallelMasterTaskLoopDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel master taskloop' after parsing of the associated statemen...
ExprResult ActOnOMPIteratorExpr(Scope *S, SourceLocation IteratorKwLoc, SourceLocation LLoc, SourceLocation RLoc, ArrayRef< OMPIteratorData > Data)
AttributeCompletion
Definition Sema.h:12896
void FindHiddenVirtualMethods(CXXMethodDecl *MD, SmallVectorImpl< CXXMethodDecl * > &OverloadedMethods)
Check if a method overloads virtual methods in a base class without overriding any.
IdentifierResolver IdResolver
Definition Sema.h:1119
bool IsInvalidUnlessNestedName(Scope *S, CXXScopeSpec &SS, NestedNameSpecInfo &IdInfo, bool EnteringContext)
IsInvalidUnlessNestedName - This method is used for error recovery purposes to determine whether the ...
const TypoExprState & getTypoExprState(TypoExpr *TE) const
bool isSimpleTypeSpecifier(tok::TokenKind Kind) const
Determine whether the token kind starts a simple-type-specifier.
Definition SemaDecl.cpp:126
llvm::DenseSet< QualType > InstantiatedNonDependentTypes
Non-dependent types used in templates that have already been instantiated by some template instantiat...
Definition Sema.h:9109
ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec &SS, SourceLocation TemplateKWLoc, LookupResult &R, const TemplateArgumentListInfo *TemplateArgs, const Scope *S, UnresolvedLookupExpr *AsULE=nullptr)
Builds an expression which might be an implicit member expression.
StmtResult ActOnOpenMPTeamsDistributeParallelForDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp teams distribute parallel for' after parsing of the associated sta...
OMPClause * ActOnOpenMPInclusiveClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'inclusive' clause.
ExprResult checkUnknownAnyArg(SourceLocation callLoc, Expr *result, QualType &paramType)
Type-check an expression that's being passed to an __unknown_anytype parameter.
StmtResult ActOnObjCAtSynchronizedStmt(SourceLocation AtLoc, Expr *SynchExpr, Stmt *SynchBody)
StmtResult ActOnOpenMPParallelForSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp parallel for simd' after parsing of the associated statement.
bool IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val, bool AllowMask) const
IsValueInFlagEnum - Determine if a value is allowed as part of a flag enum.
bool ConvertArgumentsForCall(CallExpr *Call, Expr *Fn, FunctionDecl *FDecl, const FunctionProtoType *Proto, ArrayRef< Expr * > Args, SourceLocation RParenLoc, bool ExecConfig=false)
ConvertArgumentsForCall - Converts the arguments specified in Args/NumArgs to the parameter types of ...
ExprResult ActOnBuiltinOffsetOf(Scope *S, SourceLocation BuiltinLoc, SourceLocation TypeLoc, ParsedType ParsedArgTy, ArrayRef< OffsetOfComponent > Components, SourceLocation RParenLoc)
OpenMPClauseKind isOpenMPPrivateDecl(ValueDecl *D, unsigned Level, unsigned CapLevel) const
Check if the specified variable is used in 'private' clause.
bool hasAnyUnrecoverableErrorsInThisFunction() const
Determine whether any errors occurred within this function/method/ block.
Definition Sema.cpp:2236
StmtResult ActOnLabelStmt(SourceLocation IdentLoc, LabelDecl *TheDecl, SourceLocation ColonLoc, Stmt *SubStmt)
Definition SemaStmt.cpp:553
ArrayRef< sema::FunctionScopeInfo * > getFunctionScopes() const
Definition Sema.h:802
StmtResult ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, ArrayRef< Stmt * > Handlers)
ActOnCXXTryBlock - Takes a try compound-statement and a number of handlers and creates a try statemen...
FullExprArg MakeFullExpr(Expr *Arg)
Definition Sema.h:4878
OpaquePtr< DeclGroupRef > DeclGroupPtrTy
Definition Sema.h:400
void PerformDependentDiagnostics(const DeclContext *Pattern, const MultiLevelTemplateArgumentList &TemplateArgs)
DeclContextLookupResult LookupConstructors(CXXRecordDecl *Class)
Look up the constructors for the given class.
void DiagnoseUnknownTypeName(IdentifierInfo *&II, SourceLocation IILoc, Scope *S, CXXScopeSpec *SS, ParsedType &SuggestedType, bool IsTemplateName=false)
Definition SemaDecl.cpp:683
void DiagnoseSizeOfParametersAndReturnValue(ArrayRef< ParmVarDecl * > Parameters, QualType ReturnTy, NamedDecl *D)
Diagnose whether the size of parameters or return value of a function or obj-c method definition is p...
OMPClause * ActOnOpenMPCollapseClause(Expr *NumForLoops, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'collapse' clause.
void CheckDeductionGuideTemplate(FunctionTemplateDecl *TD)
bool IsFunctionConversion(QualType FromType, QualType ToType, QualType &ResultTy)
Determine whether the conversion from FromType to ToType is a valid conversion that strips "noexcept"...
void ActOnStartDelayedMemberDeclarations(Scope *S, Decl *Record)
bool isExternalWithNoLinkageType(ValueDecl *VD)
Determine if VD, which must be a variable or function, is an external symbol that nonetheless can't b...
Definition Sema.cpp:787
llvm::SmallVector< std::pair< SourceLocation, const BlockDecl * >, 1 > ImplicitlyRetainedSelfLocs
List of SourceLocations where 'self' is implicitly retained inside a block.
Definition Sema.h:1505
ObjCInterfaceDecl * NSValueDecl
The declaration of the Objective-C NSValue class.
Definition Sema.h:1170
static int getPrintable(int I)
Definition Sema.h:2142
TypeResult ActOnTagTemplateIdType(TagUseKind TUK, TypeSpecifierType TagSpec, SourceLocation TagLoc, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy TemplateD, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgsIn, SourceLocation RAngleLoc)
Parsed an elaborated-type-specifier that refers to a template-id, such as class T::template apply.
void ActOnPragmaMSSection(SourceLocation PragmaLocation, int SectionFlags, StringLiteral *SegmentName)
Called on well formed #pragma section().
Definition SemaAttr.cpp:778
bool hasReachableDeclaration(const NamedDecl *D, llvm::SmallVectorImpl< Module * > *Modules=nullptr)
Determine whether any declaration of an entity is reachable.
Definition Sema.h:2345
bool isOpenMPTargetCapturedDecl(const ValueDecl *D, unsigned Level, unsigned CaptureLevel) const
Check if the specified variable is captured by 'target' directive.
void FindProtocolDeclaration(bool WarnOnDeclarations, bool ForObjCContainer, ArrayRef< IdentifierLocPair > ProtocolId, SmallVectorImpl< Decl * > &Protocols)
FindProtocolDeclaration - This routine looks up protocols and issues an error if they are not declare...
bool checkMSInheritanceAttrOnDefinition(CXXRecordDecl *RD, SourceRange Range, bool BestCase, MSInheritanceModel SemanticSpelling)
void MarkDeducedTemplateParameters(const FunctionTemplateDecl *FunctionTemplate, llvm::SmallBitVector &Deduced)
Definition Sema.h:8916
OMPRequiresDecl * CheckOMPRequiresDecl(SourceLocation Loc, ArrayRef< OMPClause * > Clauses)
Check restrictions on Requires directive.
StmtResult ActOnDefaultStmt(SourceLocation DefaultLoc, SourceLocation ColonLoc, Stmt *SubStmt, Scope *CurScope)
Definition SemaStmt.cpp:540
ObjCProtocolDecl * ActOnStartProtocolInterface(SourceLocation AtProtoInterfaceLoc, IdentifierInfo *ProtocolName, SourceLocation ProtocolLoc, Decl *const *ProtoRefNames, unsigned NumProtoRefs, const SourceLocation *ProtoLocs, SourceLocation EndProtoLoc, const ParsedAttributesView &AttrList)
ObjCContainerKind getObjCContainerKind() const
ExprResult BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements)
bool DiagnoseUnexpandedParameterPacks(SourceLocation Loc, UnexpandedParameterPackContext UPPC, ArrayRef< UnexpandedParameterPack > Unexpanded)
Diagnose unexpanded parameter packs.
TemplateNameKindForDiagnostics
Describes the detailed kind of a template name. Used in diagnostics.
Definition Sema.h:2760
bool CheckAltivecInitFromScalar(SourceRange R, QualType VecTy, QualType SrcTy)
bool checkStringLiteralArgumentAttr(const AttributeCommonInfo &CI, const Expr *E, StringRef &Str, SourceLocation *ArgLocation=nullptr)
Check if the argument E is a ASCII string literal.
void checkCUDATargetOverload(FunctionDecl *NewFD, const LookupResult &Previous)
Check whether NewFD is a valid overload for CUDA.
Definition SemaCUDA.cpp:905
ExprResult HandleExprEvaluationContextForTypeof(Expr *E)
CXXConstructorDecl * findInheritingConstructor(SourceLocation Loc, CXXConstructorDecl *BaseCtor, ConstructorUsingShadowDecl *DerivedShadow)
Given a derived-class using shadow declaration for a constructor and the correspnding base class cons...
static const std::string & getPrintable(const std::string &S)
Definition Sema.h:2147
PragmaClangSectionKind
pragma clang section kind
Definition Sema.h:450
@ PCSK_Invalid
Definition Sema.h:451
@ PCSK_BSS
Definition Sema.h:452
@ PCSK_Data
Definition Sema.h:453
@ PCSK_Text
Definition Sema.h:455
@ PCSK_Relro
Definition Sema.h:456
@ PCSK_Rodata
Definition Sema.h:454
ExprResult ActOnInitList(SourceLocation LBraceLoc, MultiExprArg InitArgList, SourceLocation RBraceLoc)
OMPClause * ActOnOpenMPIsDevicePtrClause(ArrayRef< Expr * > VarList, const OMPVarListLocTy &Locs)
Called on well-formed 'is_device_ptr' clause.
void warnOnReservedIdentifier(const NamedDecl *D)
StmtResult ActOnCaseStmt(SourceLocation CaseLoc, ExprResult LHS, SourceLocation DotDotDotLoc, ExprResult RHS, SourceLocation ColonLoc)
Definition SemaStmt.cpp:510
bool CheckEnumRedeclaration(SourceLocation EnumLoc, bool IsScoped, QualType EnumUnderlyingTy, bool IsFixed, const EnumDecl *Prev)
Check whether this is a valid redeclaration of a previous enumeration.
void ActOnObjCTemporaryExitContainerContext(ObjCContainerDecl *ObjCCtx)
Invoked when we must temporarily exit the objective-c container scope for parsing/looking-up C constr...
bool isCurrentClassNameTypo(IdentifierInfo *&II, const CXXScopeSpec *SS)
Determine whether the identifier II is a typo for the name of the class type currently being defined.
bool CheckQualifiedMemberReference(Expr *BaseExpr, QualType BaseType, const CXXScopeSpec &SS, const LookupResult &R)
ExprResult BuildInstanceMessage(Expr *Receiver, QualType ReceiverType, SourceLocation SuperLoc, Selector Sel, ObjCMethodDecl *Method, SourceLocation LBracLoc, ArrayRef< SourceLocation > SelectorLocs, SourceLocation RBracLoc, MultiExprArg Args, bool isImplicit=false)
Build an Objective-C instance message expression.
Decl * ActOnUsingDeclaration(Scope *CurScope, AccessSpecifier AS, SourceLocation UsingLoc, SourceLocation TypenameLoc, CXXScopeSpec &SS, UnqualifiedId &Name, SourceLocation EllipsisLoc, const ParsedAttributesView &AttrList)
void ActOnDelayedCXXMethodParameter(Scope *S, Decl *Param)
ActOnDelayedCXXMethodParameter - We've already started a delayed C++ method declaration.
StmtResult ActOnOpenMPTargetDataDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed '#pragma omp target data' after parsing of the associated statement.
void diagnoseNullResettableSynthesizedSetters(const ObjCImplDecl *impDecl)
Diagnose any null-resettable synthesized setters.
static const char * getPrintable(const char *S)
Definition Sema.h:2145
OMPClause * ActOnOpenMPAllocatorClause(Expr *Allocator, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc)
Called on well-formed 'allocator' clause.
bool areSameVectorElemTypes(QualType srcType, QualType destType)
void DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl, ObjCInterfaceDecl *IDecl, SourceLocation AtEnd)
DefaultSynthesizeProperties - This routine default synthesizes all properties which must be synthesiz...
void AddMemberOperatorCandidates(OverloadedOperatorKind Op, SourceLocation OpLoc, ArrayRef< Expr * > Args, OverloadCandidateSet &CandidateSet, OverloadCandidateParamOrder PO={})
Add overload candidates for overloaded operators that are member functions.
OMPClause * ActOnOpenMPInReductionClause(ArrayRef< Expr * > VarList, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, CXXScopeSpec &ReductionIdScopeSpec, const DeclarationNameInfo &ReductionId, ArrayRef< Expr * > UnresolvedReductions=llvm::None)
Called on well-formed 'in_reduction' clause.
ExprResult ActOnDecltypeExpression(Expr *E)
Process the expression contained within a decltype.
QualType BuildMemberPointerType(QualType T, QualType Class, SourceLocation Loc, DeclarationName Entity)
Build a member pointer type T Class::*.
void DiagnoseMultipleMethodInGlobalPool(SmallVectorImpl< ObjCMethodDecl * > &Methods, Selector Sel, SourceRange R, bool receiverIdOrClass)
AllocationFunctionScope
The scope in which to find allocation functions.
Definition Sema.h:6594
@ AFS_Both
Look for allocation functions in both the global scope and in the scope of the allocated class.
Definition Sema.h:6602
@ AFS_Class
Only look for allocation functions in the scope of the allocated class.
Definition Sema.h:6599
@ AFS_Global
Only look for allocation functions in the global scope.
Definition Sema.h:6596
StmtResult ActOnOpenMPSimdDirective(ArrayRef< OMPClause * > Clauses, Stmt *AStmt, SourceLocation StartLoc, SourceLocation EndLoc, VarsWithInheritedDSAType &VarsWithImplicitDSA)
Called on well-formed '#pragma omp simd' after parsing of the associated statement.
bool isAbstractType(SourceLocation Loc, QualType T)
TypeResult ActOnTemplateIdType(Scope *S, CXXScopeSpec &SS, SourceLocation TemplateKWLoc, TemplateTy Template, IdentifierInfo *TemplateII, SourceLocation TemplateIILoc, SourceLocation LAngleLoc, ASTTemplateArgsPtr TemplateArgs, SourceLocation RAngleLoc, bool IsCtorOrDtorName=false, bool IsClassName=false)
ASTMutationListener * getASTMutationListener() const
Definition Sema.cpp:536
Decl * ActOnStartNamespaceDef(Scope *S, SourceLocation InlineLoc, SourceLocation NamespaceLoc, SourceLocation IdentLoc, IdentifierInfo *Ident, SourceLocation LBrace, const ParsedAttributesView &AttrList, UsingDirectiveDecl *&UsingDecl)
ActOnStartNamespaceDef - This is called at the start of a namespace definition.
QualType BuildBlockPointerType(QualType T, SourceLocation Loc, DeclarationName Entity)
Build a block pointer type.
ObjCCategoryImplDecl * ActOnStartCategoryImplementation(SourceLocation AtCatImplLoc, IdentifierInfo *ClassName, SourceLocation ClassLoc, IdentifierInfo *CatName, SourceLocation CatLoc, const ParsedAttributesView &AttrList)
ActOnStartCategoryImplementation - Perform semantic checks on the category implementation declaration...
PragmaMsStackAction
Definition Sema.h:476
@ PSK_Push_Set
Definition Sema.h:482
@ PSK_Reset
Definition Sema.h:477
@ PSK_Pop_Set
Definition Sema.h:483
@ PSK_Show
Definition Sema.h:481
@ PSK_Pop
Definition Sema.h:480
@ PSK_Set
Definition Sema.h:478
@ PSK_Push
Definition Sema.h:479
SemaDiagnosticBuilder targetDiag(SourceLocation Loc, unsigned DiagID, FunctionDecl *FD=nullptr)
Definition Sema.cpp:1844
StmtResult FinishCXXForRangeStmt(Stmt *ForRange, Stmt *Body)
FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
ExprResult CorrectDelayedTyposInExpr(Expr *E, VarDecl *InitDecl=nullptr, bool RecoverUncorrectedTypos=false, llvm::function_ref< ExprResult(Expr *)> Filter=[](Expr *E) -> ExprResult { return E;})
Process any TypoExprs in the given Expr and its children, generating diagnostics as appropriate and r...
void ActOnFinishedOpenMPDeclareTargetContext(DeclareTargetContextInfo &DTCI)
Called once a target context is completed, that can be when a '#pragma omp end declare target' was en...
static CanThrowResult canCalleeThrow(Sema &S, const Expr *E, const Decl *D, SourceLocation Loc=SourceLocation())
Determine whether the callee of a particular function call can throw.
void CheckVirtualDtorCall(CXXDestructorDecl *dtor, SourceLocation Loc, bool IsDelete, bool CallCanBeVirtual, bool WarnOnNonAbstractTypes, SourceLocation DtorLoc)
ExprResult ActOnFinishFullExpr(Expr *Expr, bool DiscardedValue)
Definition Sema.h:6719
void FinalizeVarWithDestructor(VarDecl *VD, const RecordType *DeclInitType)
FinalizeVarWithDestructor - Prepare for calling destructor on the constructed variable.
CXXDestructorDecl * DeclareImplicitDestructor(CXXRecordDecl *ClassDecl)
Declare the implicit destructor for the given class.
ExprResult CreateBuiltinMatrixSubscriptExpr(Expr *Base, Expr *RowIdx, Expr *ColumnIdx, SourceLocation RBLoc)
ExprResult ActOnNameClassifiedAsOverloadSet(Scope *S, Expr *OverloadSet)
Act on the result of classifying a name as an overload set.
OMPClause * ActOnOpenMPRelaxedClause(SourceLocation StartLoc, SourceLocation EndLoc)
Called on well-formed 'relaxed' clause.
StmtResult ActOnGCCAsmStmt(SourceLocation AsmLoc, bool IsSimple, bool IsVolatile, unsigned NumOutputs, unsigned NumInputs, IdentifierInfo **Names, MultiExprArg Constraints, MultiExprArg Exprs, Expr *AsmString, MultiExprArg Clobbers, unsigned NumLabels, SourceLocation RParenLoc)
void createImplicitModuleImportForErrorRecovery(SourceLocation Loc, Module *Mod)
Create an implicit import of the given module at the given source location, for error recovery,...
ExprResult ParseObjCSelectorExpression(Selector Sel, SourceLocation AtLoc, SourceLocation SelLoc, SourceLocation LParenLoc, SourceLocation RParenLoc, bool WarnMultipleSelectors)
ParseObjCSelectorExpression - Build selector expression for @selector.
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
unsigned getHashValue() const
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
StandardConversionSequence - represents a standard conversion sequence (C++ 13.3.3....
Definition Overload.h:259
Stmt - This represents one statement.
Definition Stmt.h:70
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition Stmt.cpp:324
StringLiteral - This represents a string literal expression, e.g.
Definition Expr.h:1770
SwitchStmt - This represents a 'switch' stmt.
Definition Stmt.h:2183
Represents the declaration of a struct/union/class/enum.
Definition Decl.h:3368
Exposes information about the current target.
Definition TargetInfo.h:191
A convenient class for passing around template argument information.
A template argument list.
Location wrapper for a TemplateArgument.
Represents a template argument.
The base class of all kinds of template declarations (e.g., class, function, etc.).
This is a base class for callbacks that will be notified at every template instantiation.
Represents a C++ template name within the type system.
Stores a list of template parameters for a TemplateDecl and its derived classes.
TemplateSpecCandidateSet - A set of generalized overload candidates, used in template specializations...
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Declaration of a template type parameter.
Token - This structure provides full information about a lexed token.
Definition Token.h:34
Represents the declaration of a typedef-name via a C++11 alias-declaration.
Definition Decl.h:3340
Represents a declaration of a type.
Definition Decl.h:3176
Base wrapper for a particular "section" of type source info.
Definition TypeLoc.h:58
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
Definition TypeLoc.h:152
A container of type source information.
Definition Type.h:6530
The base class of the type hierarchy.
Definition Type.h:1556
Represents the declaration of a typedef-name via the 'typedef' type specifier.
Definition Decl.h:3320
Base class for declarations which introduce a typedef-name.
Definition Decl.h:3218
Simple class containing the result of Sema::CorrectTypo.
TypoExpr - Internal placeholder for expressions where typo correction still needs to be performed and...
Definition Expr.h:6367
Represents a C++ unqualified-id that has been parsed.
Definition DeclSpec.h:951
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition ExprCXX.h:3094
Represents a C++ member access expression for which lookup produced a set of overloaded functions.
Definition ExprCXX.h:3831
A set of unresolved declarations.
The iterator over UnresolvedSets.
Represents a C++ using-declaration.
Definition DeclCXX.h:3412
Represents C++ using-directive.
Definition DeclCXX.h:2915
Represents a shadow declaration implicitly introduced into a scope by a (resolved) using-declaration ...
Definition DeclCXX.h:3220
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition Decl.h:674
Represents a variable declaration or definition.
Definition Decl.h:874
Declaration of a variable template.
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents a GCC generic vector type.
Definition Type.h:3301
Represents a C++11 virt-specifier-seq.
Definition DeclSpec.h:2658
Consumes visible declarations found when searching for all visible names within a given scope or cont...
Definition Lookup.h:790
A set of visible modules.
Definition Module.h:735
Captures information about a #pragma weak directive.
Definition Weak.h:25
A requires-expression requirement which queries the validity and properties of an expression ('simple...
A requires-expression requirement which is satisfied when a general constraint expression is satisfie...
A static requirement that can be used in a requires-expression to check properties of types and expre...
A requires-expression requirement which queries the existence of a type name or type template special...
A declaration being accessed, together with information about how it was accessed.
Retains information about a block that is currently being parsed.
Definition ScopeInfo.h:753
Retains information about a captured region.
Definition ScopeInfo.h:779
Contains information about the compound statement currently being parsed.
Definition ScopeInfo.h:67
A collection of diagnostics which were delayed.
A diagnostic message which has been conditionally emitted pending the complete parsing of the current...
Retains information about a function, method, or block that is currently being parsed.
Definition ScopeInfo.h:102
Provides information about an attempted template argument deduction, whose success or failure was des...
unsigned long uint64_t
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Stmt, Expr > expr
Matches expressions.
const internal::VariadicDynCastAllOfMatcher< Stmt, CastExpr > castExpr
Matches any cast nodes of Clang's AST.
llvm::DenseMap< int, SourceRange > ParsedSubjectMatchRuleSet
void threadSafetyCleanup(BeforeSet *Cache)
ObjCKeywordKind
Provides a namespace for Objective-C keywords which start with an '@'.
Definition TokenKinds.h:41
TokenKind
Provides a simple uniform namespace for tokens from all C languages.
Definition TokenKinds.h:25
TypeSpecifierType
Specifies the kind of type.
Definition Specifiers.h:52
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
Definition Address.h:177
ArrayTypeTrait
Names for the array type traits.
Definition TypeTraits.h:42
@ CPlusPlus
MutableArrayRef< TemplateParameterList * > MultiTemplateParamsArg
Definition Ownership.h:276
CanThrowResult
Possible results from evaluation of a noexcept expression.
@ Specialization
We are substituting template parameters for template arguments in order to form a template specializa...
OpenMPDefaultmapClauseModifier
OpenMP modifiers for 'defaultmap' clause.
PragmaMSCommentKind
Definition PragmaKinds.h:14
ConstexprSpecKind
Define the kind of constexpr specifier.
Definition Specifiers.h:32
IfStatementKind
In an if statement, this denotes whether the the statement is a constexpr or consteval if statement.
Definition Specifiers.h:36
ObjCPropertyQueryKind
Definition DeclObjC.h:720
NullabilityKind
Describes the nullability of a particular type.
Definition Specifiers.h:317
DeductionFailureInfo MakeDeductionFailureInfo(ASTContext &Context, Sema::TemplateDeductionResult TDK, sema::TemplateDeductionInfo &Info)
Convert from Sema's representation of template deduction information to the form used in overload-can...
InClassInitStyle
In-class initialization styles for non-static data members.
Definition Specifiers.h:256
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
Definition Specifiers.h:134
OpenMPReductionClauseModifier
OpenMP modifiers for 'reduction' clause.
OverloadCandidateParamOrder
The parameter ordering that will be used for the candidate.
Definition Overload.h:85
std::unique_ptr< sema::RISCVIntrinsicManager > CreateRISCVIntrinsicManager(Sema &S)
OpenMPScheduleClauseModifier
OpenMP modifiers for 'schedule' clause.
Definition OpenMPKinds.h:38
ActionResult< Decl * > DeclResult
Definition Ownership.h:268
CapturedRegionKind
The different kinds of captured statement.
StorageClass
Storage classes.
Definition Specifiers.h:233
OpenMPDistScheduleClauseKind
OpenMP attributes for 'dist_schedule' clause.
Expr * Cond
};
TypeResult TypeError()
Definition Ownership.h:280
llvm::MutableArrayRef< ImplicitConversionSequence > ConversionSequenceList
A list of implicit conversion sequences for the arguments of an OverloadCandidate.
Definition Overload.h:806
UnaryExprOrTypeTrait
Names for the "expression or type" traits.
Definition TypeTraits.h:51
OverloadCandidateRewriteKind
The kinds of rewrite we perform on overload candidates.
Definition Overload.h:90
LambdaCaptureInitKind
Definition DeclSpec.h:2702
@ CopyInit
[a = b], [a = {b}]
@ Result
The result type of a method or function.
ActionResult< ParsedType > TypeResult
Definition Ownership.h:264
OpenMPBindClauseKind
OpenMP bindings for the 'bind' clause.
ActionResult< CXXCtorInitializer * > MemInitResult
Definition Ownership.h:266
ParameterABI
Kinds of parameter ABI.
Definition Specifiers.h:345
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
OpenMPLastprivateModifier
OpenMP 'lastprivate' clause modifier.
OpenMPDependClauseKind
OpenMP attributes for 'depend' clause.
Definition OpenMPKinds.h:54
ObjCBridgeCastKind
The kind of bridging performed by the Objective-C bridge cast.
MSVtorDispMode
In the Microsoft ABI, this controls the placement of virtual displacement members used to implement v...
Definition LangOptions.h:54
ArrayRef< std::pair< IdentifierInfo *, SourceLocation > > ModuleIdPath
A sequence of identifier/location pairs used to describe a particular module or submodule,...
TagTypeKind
The kind of a tag type.
Definition Type.h:5443
std::pair< llvm::PointerUnion< const TemplateTypeParmType *, NamedDecl * >, SourceLocation > UnexpandedParameterPack
Definition Sema.h:242
LangAS
Defines the address space values used by the address space qualifier of QualType.
CastKind
CastKind - The kind of operation required for a conversion.
TranslationUnitKind
Describes the kind of translation unit being processed.
@ TU_Complete
The translation unit is a complete translation unit.
@ TU_Prefix
The translation unit is a prefix to a translation unit, and is not complete.
ComparisonCategoryType
An enumeration representing the different comparison categories types.
PragmaMSStructKind
Definition PragmaKinds.h:23
OpenMPDefaultmapClauseKind
OpenMP attributes for 'defaultmap' clause.
OpenMPLinearClauseKind
OpenMP attributes for 'linear' clause.
Definition OpenMPKinds.h:62
TemplateNameKind
Specifies the kind of template name that an identifier refers to.
@ TNK_Var_template
The name refers to a variable template whose specialization produces a variable.
@ TNK_Type_template
The name refers to a template whose specialization produces a type.
@ TNK_Function_template
The name refers to a function template or a set of overloaded functions that includes at least one fu...
@ TNK_Concept_template
The name refers to a concept.
@ TNK_Undeclared_template
Lookup for the name failed, but we're assuming it was a template name anyway.
llvm::omp::Directive OpenMPDirectiveKind
OpenMP directives.
Definition OpenMPKinds.h:24
std::pair< SourceLocation, PartialDiagnostic > PartialDiagnosticAt
A partial diagnostic along with the source location where this diagnostic occurs.
LambdaCaptureDefault
The default, if any, capture method for a lambda expression.
Definition Lambda.h:22
PragmaFloatControlKind
Definition PragmaKinds.h:28
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Definition Specifiers.h:117
@ VK_PRValue
A pr-value expression (in the C++11 taxonomy) produces a temporary value.
Definition Specifiers.h:120
SmallVector< CXXBaseSpecifier *, 4 > CXXCastPath
A simple array of base specifiers.
Definition Expr.h:60
MSInheritanceModel
Assigned inheritance model for a class in the MS C++ ABI.
Definition Specifiers.h:371
llvm::PointerUnion< TemplateTypeParmDecl *, NonTypeTemplateParmDecl *, TemplateTemplateParmDecl * > TemplateParameter
Stores a template parameter of any kind.
TPOC
The context in which partial ordering of function templates occurs.
Definition Template.h:237
OpenMPAtomicDefaultMemOrderClauseKind
OpenMP attributes for 'atomic_default_mem_order' clause.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Definition Specifiers.h:173
CallingConv
CallingConv - Specifies the calling convention that a function uses.
Definition Specifiers.h:263
ObjCTypeParamVariance
Describes the variance of a given generic parameter.
Definition DeclObjC.h:557
U cast(CodeGen::Address addr)
Definition Address.h:174
OpenMPDeviceClauseModifier
OpenMP modifiers for 'device' clause.
Definition OpenMPKinds.h:47
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition Ownership.h:243
ElaboratedTypeKeyword
The elaboration keyword that precedes a qualified type name or introduces an elaborated-type-specifie...
Definition Type.h:5462
llvm::omp::Clause OpenMPClauseKind
OpenMP clauses.
Definition OpenMPKinds.h:27
ActionResult< Expr * > ExprResult
Definition Ownership.h:262
OpenMPOrderClauseKind
OpenMP attributes for 'order' clause.
TypeTrait
Names for traits that operate specifically on types.
Definition TypeTraits.h:21
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_None
no exception specification
@ EST_BasicNoexcept
noexcept
@ EST_NoexceptFalse
noexcept(expression), evals to 'false'
@ EST_Dynamic
throw(T1, T2)
OpenMPScheduleClauseKind
OpenMP attributes for 'schedule' clause.
Definition OpenMPKinds.h:30
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition Specifiers.h:108
@ AS_none
Definition Specifiers.h:112
ActionResult< Stmt * > StmtResult
Definition Ownership.h:263
OpenMPMapClauseKind
OpenMP mapping kind for 'map' clause.
Definition OpenMPKinds.h:70
NonOdrUseReason
The reason why a DeclRefExpr does not constitute an odr-use.
Definition Specifiers.h:158
YAML serialization mapping.
Definition Dominators.h:30
#define true
Definition stdbool.h:21
#define false
Definition stdbool.h:22
#define bool
Definition stdbool.h:20
The result of a constraint satisfaction check, containing the necessary information to diagnose an un...
Definition ASTConcept.h:78
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
ParamInfo - An array of paraminfo objects is allocated whenever a function declarator is parsed.
Definition DeclSpec.h:1252
A structure used to record information about a failed template argument deduction,...
This little struct is used to capture information about structure field declarators,...
Definition DeclSpec.h:2648
Describes whether we've seen any nullability information for the given file.
Definition Sema.h:246
SourceLocation PointerEndLoc
The end location for the first pointer declarator in the file.
Definition Sema.h:253
SourceLocation PointerLoc
The first pointer declarator (of any pointer kind) in the file that does not have a corresponding nul...
Definition Sema.h:249
bool SawTypeNullability
Whether we saw any type nullability annotations in the given file.
Definition Sema.h:259
uint8_t PointerKind
Which kind of pointer declarator we saw.
Definition Sema.h:256
Holds information about the various types of exception specification.
Definition Type.h:4013
ExceptionSpecificationType Type
The kind of exception specification this is.
Definition Type.h:4015
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Definition Type.h:4018
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
Definition Type.h:4021
Extra information about a function prototype.
Definition Type.h:4039
Wraps an identifier and optional source location for the identifier.
Definition ParsedAttr.h:211
Represents a complete lambda introducer.
Definition DeclSpec.h:2710
Contains a late templated function.
Definition Sema.h:13589
Decl * D
The template function declaration to be late parsed.
Definition Sema.h:13592
A normalized constraint, as defined in C++ [temp.constr.normal], is either an atomic constraint,...
Definition SemaConcept.h:81
Iterator range representation begin:end[:step].
Definition ExprOpenMP.h:278
This structure contains most locations needed for by an OMPVarListClause.
a linked list of methods with the same selector name but different signatures.
OverloadCandidate - A single candidate in an overload set (C++ 13.3).
Definition Overload.h:810
Describes how types, statements, expressions, and declarations should be printed.
SourceLocation CurrentPragmaLocation
Definition Sema.h:684
A context in which code is being synthesized (where a source location alone is not sufficient to iden...
Definition Sema.h:8936
SourceRange InstantiationRange
The source range that covers the construct that cause the instantiation, e.g., the template-id that c...
Definition Sema.h:9085
enum clang::Sema::CodeSynthesisContext::SynthesisKind Kind
bool SavedInNonInstantiationSFINAEContext
Was the enclosing context a non-instantiation SFINAE context?
Definition Sema.h:9038
const TemplateArgument * TemplateArgs
The list of template arguments we are substituting, if they are not part of the entity.
Definition Sema.h:9054
sema::TemplateDeductionInfo * DeductionInfo
The template deduction info object associated with the substitution or checking of explicit or deduce...
Definition Sema.h:9080
ArrayRef< TemplateArgument > template_arguments() const
Definition Sema.h:9073
NamedDecl * Template
The template (or partial specialization) in which we are performing the instantiation,...
Definition Sema.h:9049
SourceLocation PointOfInstantiation
The point of instantiation or synthesis within the source code.
Definition Sema.h:9041
unsigned NumCallArgs
The number of expressions in CallArgs.
Definition Sema.h:9067
const Expr *const * CallArgs
The list of argument expressions in a synthesized call.
Definition Sema.h:9057
unsigned NumTemplateArgs
The number of template arguments in TemplateArgs.
Definition Sema.h:9064
SynthesisKind
The kind of template instantiation we are performing.
Definition Sema.h:8938
@ MarkingClassDllexported
We are marking a class as __dllexport.
Definition Sema.h:9024
@ DefaultTemplateArgumentInstantiation
We are instantiating a default argument for a template parameter.
Definition Sema.h:8948
@ ExplicitTemplateArgumentSubstitution
We are substituting explicit template arguments provided for a function template.
Definition Sema.h:8957
@ DefaultTemplateArgumentChecking
We are checking the validity of a default template argument that has been used when naming a template...
Definition Sema.h:8973
@ InitializingStructuredBinding
We are initializing a structured binding.
Definition Sema.h:9021
@ ExceptionSpecInstantiation
We are instantiating the exception specification for a function template which was deferred until it ...
Definition Sema.h:8981
@ NestedRequirementConstraintsCheck
We are checking the satisfaction of a nested requirement of a requires expression.
Definition Sema.h:8988
@ BuildingBuiltinDumpStructCall
We are building an implied call from __builtin_dump_struct.
Definition Sema.h:9028
@ DefiningSynthesizedFunction
We are defining a synthesized function (such as a defaulted special member).
Definition Sema.h:8999
@ Memoization
Added for Template instantiation observation.
Definition Sema.h:9034
@ DeducedTemplateArgumentSubstitution
We are substituting template argument determined as part of template argument deduction for either a ...
Definition Sema.h:8964
@ PriorTemplateArgumentSubstitution
We are substituting prior template arguments into a new template parameter.
Definition Sema.h:8969
@ ExceptionSpecEvaluation
We are computing the exception specification for a defaulted special member function.
Definition Sema.h:8977
@ TemplateInstantiation
We are instantiating a template declaration.
Definition Sema.h:8941
@ DeclaringSpecialMember
We are declaring an implicit special member function.
Definition Sema.h:8991
@ DeclaringImplicitEqualityComparison
We are declaring an implicit 'operator==' for a defaulted 'operator<=>'.
Definition Sema.h:8995
@ DefaultFunctionArgumentInstantiation
We are instantiating a default argument for a function.
Definition Sema.h:8953
@ RewritingOperatorAsSpaceship
We are rewriting a comparison operator in terms of an operator<=>.
Definition Sema.h:9018
@ RequirementInstantiation
We are instantiating a requirement of a requires expression.
Definition Sema.h:8984
CXXSpecialMember SpecialMember
The special member being declared or defined.
Definition Sema.h:9070
Decl * Entity
The entity that is being synthesized.
Definition Sema.h:9044
bool isInstantiationRecord() const
Determines whether this template is an actual instantiation that should be counted toward the maximum...
OMPDeclareTargetDeclAttr::MapTypeTy MT
Definition Sema.h:10595
Data structure used to record current or nested expression evaluation contexts.
Definition Sema.h:1271
SmallVector< CXXBindTemporaryExpr *, 8 > DelayedDecltypeBinds
If we are processing a decltype type, a set of temporary binding expressions for which we have deferr...
Definition Sema.h:1303
SmallVector< Expr *, 2 > VolatileAssignmentLHSs
Expressions appearing as the LHS of a volatile assignment in this context.
Definition Sema.h:1310
llvm::SmallPtrSet< const Expr *, 8 > PossibleDerefs
Definition Sema.h:1305
Decl * ManglingContextDecl
The declaration that provides context for lambda expressions and block literals if the normal declara...
Definition Sema.h:1295
SmallVector< CallExpr *, 8 > DelayedDecltypeCalls
If we are processing a decltype type, a set of call expressions for which we have deferred checking t...
Definition Sema.h:1299
llvm::SmallPtrSet< DeclRefExpr *, 4 > ReferenceToConsteval
Set of DeclRefExprs referencing a consteval function when used in a context not already known to be i...
Definition Sema.h:1317
llvm::SmallVector< ImmediateInvocationCandidate, 4 > ImmediateInvocationCandidates
Set of candidates for starting an immediate invocation.
Definition Sema.h:1313
enum clang::Sema::ExpressionEvaluationContextRecord::ExpressionKind ExprContext
SmallVector< LambdaExpr *, 2 > Lambdas
The lambdas that are present within this context, if it is indeed an unevaluated context.
Definition Sema.h:1290
ExpressionKind
Describes whether we are in an expression constext which we have to handle differently.
Definition Sema.h:1321
CleanupInfo ParentCleanup
Whether the enclosing context needed a cleanup.
Definition Sema.h:1276
unsigned NumTypos
The number of typos encountered during this expression evaluation context (i.e.
Definition Sema.h:1284
ExpressionEvaluationContextRecord(ExpressionEvaluationContext Context, unsigned NumCleanupObjects, CleanupInfo ParentCleanup, Decl *ManglingContextDecl, ExpressionKind ExprContext)
Definition Sema.h:1330
ExpressionEvaluationContext Context
The expression evaluation context.
Definition Sema.h:1273
unsigned NumCleanupObjects
The number of active cleanup objects when we entered this expression evaluation context.
Definition Sema.h:1280
FormatArgumentPassingKind ArgPassingKind
Definition Sema.h:13036
A pair of a canonical FunctionDecl and a SourceLocation.
Definition Sema.h:12581
CanonicalDeclPtr< FunctionDecl > FD
Definition Sema.h:12582
An RAII helper that pops function a function scope on exit.
Definition Sema.h:4920
A stack object to be created when performing template instantiation.
Definition Sema.h:9210
bool isInvalid() const
Determines whether we have exceeded the maximum recursive template instantiations.
Definition Sema.h:9349
InstantiatingTemplate(Sema &SemaRef, SourceLocation PointOfInstantiation, Decl *Entity, SourceRange InstantiationRange=SourceRange())
Note that we are instantiating a class template, function template, variable template,...
void Clear()
Note that we have finished instantiating this template.
bool isAlreadyInstantiating() const
Determine whether we are already instantiating this specialization in some surrounding active instant...
Definition Sema.h:9353
LocalInstantiationScope * Scope
Definition Sema.h:9730
LateInstantiatedAttribute(const Attr *A, LocalInstantiationScope *S, Decl *D)
Definition Sema.h:9733
bool isMoveEligible() const
Definition Sema.h:5047
bool isCopyElidable() const
Definition Sema.h:5048
const VarDecl * Candidate
Definition Sema.h:5042
Keeps information about an identifier in a nested-name-spec.
Definition Sema.h:6768
IdentifierInfo * Identifier
The identifier preceding the '::'.
Definition Sema.h:6774
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, ParsedType ObjectType=ParsedType())
Creates info object for the most typical case.
Definition Sema.h:6783
SourceLocation IdentifierLoc
The location of the identifier.
Definition Sema.h:6777
SourceLocation CCLoc
The location of the '::'.
Definition Sema.h:6780
ParsedType ObjectType
The type of the object, if we're parsing nested-name-specifier in a member access expression.
Definition Sema.h:6771
NestedNameSpecInfo(IdentifierInfo *II, SourceLocation IdLoc, SourceLocation ColonColonLoc, QualType ObjectType)
Definition Sema.h:6789
Data structure for iterator expression.
Definition Sema.h:5606
OMPIteratorExpr::IteratorRange Range
Definition Sema.h:5610
SourceLocation DeclIdentLoc
Definition Sema.h:5608
IdentifierInfo * DeclIdent
Definition Sema.h:5607
SourceLocation AssignLoc
Definition Sema.h:5611
SourceLocation ColonLoc
Definition Sema.h:5612
SourceLocation SecColonLoc
Definition Sema.h:5613
IdentifierInfo * Name
Definition Sema.h:10060
ParsedAttributesView ArgAttrs
ArgAttrs - Attribute list for this argument.
Definition Sema.h:10068
ObjCDeclSpec DeclSpec
Definition Sema.h:10065
SourceLocation NameLoc
Definition Sema.h:10061
SourceLocation LocStart
Definition Sema.h:5809
IdentifierInfo * IdentInfo
Definition Sema.h:5812
union clang::Sema::OffsetOfComponent::@237 U
Data used for processing a list of variables in OpenMP clauses.
Definition Sema.h:11611
CXXScopeSpec ReductionOrMapperIdScopeSpec
Definition Sema.h:11615
SmallVector< OpenMPMapModifierKind, NumberOfOMPMapClauseModifiers > MapTypeModifiers
Definition Sema.h:11620
SmallVector< OpenMPMotionModifierKind, NumberOfOMPMotionModifiers > MotionModifiers
Definition Sema.h:11624
SourceLocation ExtraModifierLoc
Definition Sema.h:11627
DeclarationNameInfo ReductionOrMapperId
Definition Sema.h:11616
SmallVector< SourceLocation, NumberOfOMPMotionModifiers > MotionModifiersLoc
Definition Sema.h:11625
SourceLocation OmpAllMemoryLoc
Definition Sema.h:11628
SmallVector< SourceLocation, NumberOfOMPMapClauseModifiers > MapTypeModifiersLoc
Definition Sema.h:11622
int ExtraModifier
Additional modifier for linear, map, depend or lastprivate clause.
Definition Sema.h:11617
brief A function argument from which we performed template argument
Definition Sema.h:8768
OriginalCallArg(QualType OriginalParamType, bool DecomposedParam, unsigned ArgIdx, QualType OriginalArgType)
Definition Sema.h:8769
This an attribute introduced by #pragma clang attribute.
Definition Sema.h:733
SmallVector< attr::SubjectMatchRule, 4 > MatchRules
Definition Sema.h:736
A push'd group of PragmaAttributeEntries.
Definition Sema.h:741
SourceLocation Loc
The location of the push attribute.
Definition Sema.h:743
SmallVector< PragmaAttributeEntry, 2 > Entries
Definition Sema.h:746
const IdentifierInfo * Namespace
The namespace of this push group.
Definition Sema.h:745
SourceLocation PragmaLocation
Definition Sema.h:467
Slot(llvm::StringRef StackSlotLabel, ValueType Value, SourceLocation PragmaLocation, SourceLocation PragmaPushLocation)
Definition Sema.h:595
llvm::StringRef StackSlotLabel
Definition Sema.h:591
SourceLocation PragmaLocation
Definition Sema.h:593
SourceLocation PragmaPushLocation
Definition Sema.h:594
ValueType CurrentValue
Definition Sema.h:665
void SentinelAction(PragmaMsStackAction Action, StringRef Label)
Definition Sema.h:651
bool hasValue() const
Definition Sema.h:661
SmallVector< Slot, 2 > Stack
Definition Sema.h:663
ValueType DefaultValue
Definition Sema.h:664
SourceLocation CurrentPragmaLocation
Definition Sema.h:666
PragmaStack(const ValueType &Default)
Definition Sema.h:658
void Act(SourceLocation PragmaLocation, PragmaMsStackAction Action, llvm::StringRef StackSlotLabel, ValueType Value)
Definition Sema.h:602
ProcessDeclAttributeOptions WithIgnoreTypeAttributes(bool Val)
Definition Sema.h:4527
ProcessDeclAttributeOptions WithIncludeCXX11Attributes(bool Val)
Definition Sema.h:4521
ReferenceConversions
The conversions that would be performed on an lvalue of type T2 when binding a reference of type T1 t...
Definition Sema.h:12294
NamedDecl * Previous
Definition Sema.h:2523
Abstract class used to diagnose incomplete types.
Definition Sema.h:2135
virtual void diagnose(Sema &S, SourceLocation Loc, QualType T)=0
TypeTagData(QualType Type, bool LayoutCompatible, bool MustBeNull)
Definition Sema.h:13285
unsigned LayoutCompatible
If true, Type should be compared with other expression's types for layout-compatibility.
Definition Sema.h:13294
Data for list of allocators.
Definition Sema.h:11804
Expr * Allocator
Allocator.
Definition Sema.h:11806
SourceLocation LParenLoc
Locations of '(' and ')' symbols.
Definition Sema.h:11810
Expr * AllocatorTraits
Allocator traits.
Definition Sema.h:11808
Information about a template-id annotation token.
static bool isEqual(const FunctionDeclAndLoc &LHS, const FunctionDeclAndLoc &RHS)
Definition Sema.h:13625
static unsigned getHashValue(const FunctionDeclAndLoc &FDL)
Definition Sema.h:13620
DenseMapInfo< clang::CanonicalDeclPtr< clang::FunctionDecl > > FDBaseInfo
Definition Sema.h:13610